Posts

Showing posts from August, 2010

C++ std::setprecision in C# -

i'm picking c# porting legacy c++ code , keep output identical. used along lines of output << std::setprecision(10) << (double) value; i figured be output.write("{0:f10}", value); but didn't trick. values > 1 more digits. common online suggestion math.round first, appends zeroes if total length < 10 . so put together: // std::setprecision not same ":f10", mirror original behavior static string setprecision(double value) { string ret = value.tostring(); // don't substring(0, 11), need apply rounding, // , don't this, don't want append zeroes, // 10 digits + period, 0.. not counting total if(ret.length > digits + 1) ret = math.round(value, digits + (value < 1 ? 1 : 0) - ret.indexof('.')).tostring(); return ret; } where digits static constant; make variable, project in particular makes little sense so. still, seems overly

c# - RegionInfo.CurrentRegion doesn't correspond to Settings value -

i'm writing windows 10 uwp app needs bring different page depending on region you're in. i've found region read "us", if change location china, add chinese keyboard, set language chinese, etc. idea how make windows change regioninfo.currentregion?

domain driven design - Strategy to introduce CQRS in classic CRUD system -

i'm looking way migrate cqrs driven architecture running anaemic model/transaction script'ish system. thinking of making current state (handcrafted) snapshot event sourcing pick further changes. proper way it? yes, 1 way it. used special xxximported event current state make import event explicit (even though xxximported not part of domain language). we found it's idea conversion gradually, , start use cases can see benefits of using cqrs+es, i.e., can actual performance gains, can achieve looser coupling or can benefit explicit event history. trivial use cases, or cases performance doesn't matter, can converted later.

java - Using the Trial version of UFT together with the Trial version of ALM -

i trying set alm uft demo versions. both programs demo versions. i have installed alm, find had mess java-paths working java application want test. i have problem bridge between uft , alm not seem work, because there seems licensing issue. cannot post screenshot, because alm seems have stopped working after disabled java path environment variables. can use community or demo-license alm , uft work together?

Can you track video events like play, stop, and finished with Classic Analytics? -

i'm new event tracking services offered google analytics. wondering if track video events using classic analytics or did need implement universal analytics? plus code use implement kind of event tracking? extremely appreciated. thank you! each video provider (in case youtube/vimeo) have different api callbacks you'll need include javascript on webpages pick api callbacks when events triggered (i.e. video played, video paused, video complete etc) , fire analytics events. i've used both of these in past , both provide functionality you're looking for, they'll trigger events in google analytics , should compatible classic analytics, universal analytics , google tag manager: vimeo - http://www.sanderheilbron.nl/vimeo.ga.js/ youtube - http://www.lunametrics.com/blog/2015/05/11/updated-youtube-tracking-google-analytics-gtm/

mysql - Multiple table search then show null if not found -

i using mysql. have 2 tables: kecamatan id | name | slug | kota_id 1 kec1 kec1 1 2 kec2 kec2 1 kota id | namek | slugk 1 kot1 kot1 2 kot2 kot2 i want search in 2 tables 1 query; how result this? let's search slug containing "kot1" ; result be: id | name | slug | namek | slugk 1 null null kot1 kot1 then when search slug containing "kec2" , result be: id | name | slug | namek | slugk 1 kec2 kec2 null null

php - How to upload xml file to a path in wordpress plugin? -

Image
i'm writing custom plugin import data custom xml wordpress database. after activating plugin , uploading xml file, showing error "sorry, xml files allowed". have used xml file. i'm not sure why file not getting uploaded location. echoed location , file name, file name not being displayed. i'm using php code upload section. not sure i'm following right way. here snapshot , code here code url: code here it seems you've not used enctype="multipart/form-data" may first reason file not being uploaded. see here: http://php.net/manual/en/features.file-upload.post-method.php

c# - Restsharp returns 403 while Postman returns 200 -

this (modified) snippet postman gives successful call page. var client = new restclient("http://sub.example.com/wp-json/wp/v2/users/me"); var request = new restrequest(method.get); request.addheader("authorization", "basic anvyytp3mmzacmo2egtbohjsrwrt"); irestresponse response = client.execute(request); but when placed in c# app returns 403 forbidden, while postman makes , recieves 200. same thing happens when use httpclient in app (403). use restclient.authenticator instead: var client = new restclient("http://sub.example.com/wp-json/wp/v2/users/me") { authenticator = new httpbasicauthenticator("user", "pass"); }; var request = new restrequest(method.get); irestresponse response = client.execute(request); edit: since issue (as mentioned in comments) fact restsharp doesn't flow authentication through redirects, i'd suggest going combination of httpclient httpclienthandler set authenti

Inno Setup define a hexidecimal color constant -

i trying use [ispp] section define hexidecimal color later used in [code] section spot color, value of may change in future, getting type mismatch error when running. here relevant sections code: [ispp] #define colorpetrol "$c8c264" [code] procedure initializewizard(); var portlabel: tnewstatictext; begin portlabel := tnewstatictext.create(wizardform); portlabel.caption := 'port'; portlabel.top := scaley(78); portlabel.parent := page.surface; portlabel.font.color := expandconstant('{#colorpetrol}'); end; i assuming error caused define constant being string , portlabel.font.color requiring hex value. how can constant defined in [ispp] section , used in way correctly? just use portlabel.font.color := {#colorpetrol}; . expandconstant() expanding built-in inno setup constants, not ispp defines. latter textual replacements. as side note, i'm not aware of [ispp] section. imo should move define [code] section.

uml - Activity Diagram with multiple end points -

my question may simple, confused because have no idea activity diagrams. my question- multiple end points ever acceptable in activity diagram? it's bit touchy reference ibm though 1 of big omg parents. "truth" written in omg's superstructures. actually uml2.5 talks final node in context of activity diagrams: final nodes a finalnode controlnode @ flow in activity stops. finalnode shall not have outgoing activityedges. finalnode accepts tokens offered on incoming activityedges. there 2 kinds of finalnode: a flowfinalnode finalnode terminates flow. tokens accepted flowfinalnode destroyed. has no effect on other flows in activity. an activityfinalnode finalnode stops flows in activity ... a controlnode kind of activitynode , form activities . definition except in context of finalnode not tell how single activitynode s can related. can have many like/need.

python - How to access a variable from one function in another -

i know may seem copy many other questions asked on stack overflow, didn't understand of questions. need clarify me, , please don't flag this. i'm running on python 3.4.2, windows 8.1 sample code: def function_a(): my_name = "pamal mangat" return my_name def function_b(name): print("hello " + name) function_b(function_a.my_name) you need call function_a() way you're calling function_b() ; that's how return value. can't access variables inside function that; besides, exist while function running. def function_a(): my_name = "pamal mangat" return my_name def function_b(name): print("hello " + name) function_b(function_a())

ReSharper big font in Visual Studio 2015 -

Image
not sure if big font comes windows 10 setting or resharper still not integrated visual studio 2015. else have same problem? resharper allows either use visual studio intellisense font or text editor font (under resharper -> options... -> environment -> intellisense -> completion appearance ) the visual studio intellisense font set in visual studio by: tools -> options... -> environment -> fonts , colors , change setting statement completion (or uninstall xamarin tools...)

meteor - Adding a field to Categories? -

i want change way post list rendered in telescope based off property of category in. i.e. 1 category listview when gridview. i tried: categories.addfield({ fieldname: 'gridtype', fieldschema: { type: number, optional: true, autoform: { omit: true } } }); the issue im not seeing property added, noticed in documentation intended posts, users, comments ect i'm guessing should work. the reason not think working it's showing on create category form you need remove autoform:{omit: true} . mentions in docs if want hide forms should pass omit option, otherwise can leave out. also, sure add in file that's accessible on both client , server, otherwise you'll see in schema on client categories.simpleschema()._schema it'll have persist on server.

Embedded MongoDB in Spring Boot App can't connect with Mongo shell -

i running spring boot app has mongodb embedded in it. when start app, mongodb starts , db called 'testdb' created. if launch mongo shell , 'show dbs', 'testdb' not listed. if use postman post data mongodb can get, know mondodb working in app. how, if possible, can connect embedded instance of mongodb can test shell?

classnotfoundexception - VerifyError from com.google.android.gms:play-services:4.4.52 dependency -

after including com.google.android.gms:play-services:4.4.52 dependency (for google+-login within android app) have problem running test cases robotium , junit on jenkins. seems no matter test case, test fails verifyerror (i've observed classnotfound- , noclassdeffounderror's afterwards). stacktraces: verifyerror: java.lang.verifyerror: org/catrobat/catroid/uitest/content/brick/setsizetobricktest @ java.lang.class.getdeclaredconstructors(native method) @ java.lang.class.getconstructors(class.java:508) @ android.test.suitebuilder.testgrouping$testcasepredicate.hasvalidconstructor(testgrouping.java:228) @ android.test.suitebuilder.testgrouping$testcasepredicate.apply(testgrouping.java:217) @ android.test.suitebuilder.testgrouping$testcasepredicate.apply(testgrouping.java:213) @ android.test.suitebuilder.testgrouping.select(testgrouping.java:172) @ android.test.suitebuilder.testgrouping.selecttestclasses(testgrouping.java:162) @ android.test.

Rebol text fields - checking values and changing colors -

in following prototype test code, i'm trying create comparison system compares 2 fields, , colors them depending on whether equal or not. comparecolors: [ either answer-user/text = answer-correct/text [ answer-user/font/color: green answer-correct/font/color: green show answer-user show answer-correct ][ answer-user/font/color: red answer-correct/font/color: black show answer-user show answer-correct ] ] view layout [ answer: field [ answer-user/text: copy answer/text comparecolors show answer focus answer show answer-user ] label "compare" answer-user: info answer-correct: info across text-list "hello" "goodbye" "boy" "girl" "soldier" [ answer-correct/text: copy value comparecolors show answer-correct ] ] some problems having: the green colo

sprite kit - Swift: can't add SKProductsRequestDelegate protocol to GameScene class? -

so i'm trying implement in app purchases in sprite kit game , i'm working in swift. know need add skproductsrequestdelegate , skpaymenttransactionobserver protocols gamescene class in order this, when add them error: type 'gamescene' not conform protocol 'skproductsrequestdelegate' and similar error skpaymenttransactionobserver . i imported storekit , here code: import spritekit import avfoundation import storekit class gamescene: skscene, skphysicscontactdelegate, skproductsrequestdelegate, skpaymenttransactionobserver { what doing wrong? you have old version of function paymentqueue this: func paymentqueue(queue: skpaymentqueue, updatedtransactions transactions: [anyobject]) {... } this functions declared this: func paymentqueue(queue: skpaymentqueue, updatedtransactions transactions: [skpaymenttransaction]) {... } the productrequest should declare this: func productsrequest (request: skproductsrequest, didreceiveres

Sed regex change of file -

i (unsuccessfully) trying substitute database host entry in magento local.xml file (the connection string file). the line following: <host><![cdata[localhost]]></host> i want find line contains "host" sed , replace content of inner brackets else. note - content of inner brackets won't "localhost", s/localhost/lala/g won't work. i got following: sed -i "/\<host\>/s/.../lala/2" local.xml help please. with gnu sed: sed 's|\(<host><!\[cdata\[\).*\(\]\]></host>\)|\1lala\2|' file or sed -e 's|(<host><!\[cdata\[).*(\]\]></host>)|\1lala\2|' file output: <host><![cdata[lala]]></host>

c# - "Cannot fall through" Switch Error -

} else { int indexgenerator = numbergenerator.next(1, 4); int answer1 = finaluserinput - thecorrectanswer; switch (indexgenerator) { case 1: console.writeline("you off by" + answer1); case 2: console.writeline("so close. maybe if add or subtract " + answer1 + "?"); when try switch work, error message pops saying control case cannot fall through case1 another. you need add break; @ end of each case in switch statement. switch (indexgenerator) { case 1: console.writeline("you off by" + answer1); break; case 2: console.writeline("so close. maybe if add or subtract " + answer1 + "?"); break; }

mysql - replace text based on another column value -

first time post , looking little bit of help, i'd grateful if advise me, i have table on server, eg:- column column b column c 1 30-08-2015 hello 42 3 30-08-2015 hello 45 2 30-08-2015 hello 20 4 30-08-2015 hello 1 1 30-08-2015 hello 32 1 30-08-2015 hello 21 2 30-08-2015 hello 21 3 30-08-2015 hello 0 4 30-08-2015 hello 21 1 30-08-2015 hello 24 1 30-08-2015 hello 67 i looking command change column b 30-08-2015 bye when column = 1 i've found few replace statements doesnt take account value of column a. advice?? i'd @ mysql update command . allow update table set b='30-08-2015 bye' a=1;

How to set a global variable in Python -

ok, i've been looking around around 40 minutes how set global variable on python, , results got complicated , advanced questions , more answers. i'm trying make slot machine in python, , want make coins system, can earn coins game better, when ran code, told me 'unboundlocalerror: local variable referenced before assignment'. made variable global, putting: global coins coins = 50 which reason printed '50' , gave unboundlocalerror error again, 1 answer tried: def globalcoins(): global coins coins = 50 which, despite following error, didn't print '50': 'nameerror: global name 'coins' not defined'. soo don't know how set one. extremely basic stuff , duplicate question, web searches , attempts in-program have proved fruitless, i'm in doldrums now. omit 'global' keyword in declaration of coins outside function. this article provides survey of globals in python. example, code: def

linux - Save Bash Shell Script Output To a File with a String -

i have executable takes file , outputs line. running loop on directory: for file in $directory/*.png ./eval $file >> out.txt done the output of executable not contain name of file. want append file name each output. edit1 perhaps, not explain correctly want name of file , output of program well, processing same file, doing following for file in $directory/*.png echo -n $file >> out.txt or printf "%s" "$file" >> out.txt ./eval $file >> out.txt done for both new line inserted if understood question, want is: get name of file, ...and output or program processing file (in case, eval), ...on same line. , last part problem. then i'd suggest composing single line of text (using echo), comprising: the name of file, $file part, ...followed separator, may not need may further processing of result. used ":". can skip part if not interesting you, ...followed output of pr

css - How to tackle a page with fixed vertical and horizontal navigation -

i linked jpeg request better illustrate questions ( https://drive.google.com/file/d/0b7gjrjsubwettda1s1jpefawwfe/view?usp=sharing ). new @ css , html , want push myself (something doing fun). making dashboard similar gmail inbox, using skeleton boilerplate. i have main header (menu) made. trying figure out vertical navigation , second header? do make vertical nav list? how line 2nd header right of vertical nav? guess looking strategy. sorry, being such noob question. input help. some thoughts: jsfiddle demo for google-friendly seo, enclose nav inside <nav></nav> tags, , use anchor tags menu items, whether inside list structure or not: <ul><li><a html="#">menu item</a></li></ul> break page chunks, using divs. put every discreet section (block? part?) divs. or, use twitter's bootstrap (which same thing). something this: <body> <div id="wrap"> <div id="header&quo

json - Cannot find symbol variable Android Studio -

i working on parsing data json url. jsonobjects have different keys. want data each json object , when doesn't have key want give default message. this i'm trying use: if(myjsonobject.has("mykey")) { <- in case "abv" //it has it, appropriate processing } i got variable private static final string tag_abv = "abv"; i tried doing check if abv key included in json , give string default text of "no value" when not inculed. if (jsonstr != null) { try { jsonobject jsonobj = new jsonobject(jsonstr); // getting json array node data = jsonobj.getjsonarray(tag_data); // looping through (int = 0; < data.length(); i++) { jsonobject c = data.getjsonobject(i); if(c.has("abv")) { string abv = c.getstring(tag_abv);

Coin toss with JavaScript and HTML -

i need fixing script. basically, want flip coin , update <span> result, i.e. if it's heads or tails. @ moment, nothing happens when click button. javasript: var heads = 0; var tails = 0; function click() { x = (math.floor(math.random() * 2) == 0); if(x){ flip("heads"); }else{ flip("tails"); } }; function flip(coin) { document.getelementbyid("result").innerhtml = coin; }; html: <button id="click" type="button">click me</button> <p> got: <span id="result"></span> </p> that's because need attach event handler: document.getelementbyid('click').onclick = click; var heads = 0; var tails = 0; function click() { x = (math.floor(math.random() * 2) == 0); if(x){ flip("heads"); }else{ flip("tails"); } }; function flip(coin) { document.getelem

firefox addon - Add-on for Submitting File from Clipboard -

is there browser-add-on can create temporary txt file clipboard , populate file submit dialog? guide firefox: get data clipboard this: paste data clipboard using document.execcommand("paste"); within firefox extension now can either create temporary file os.file: https://developer.mozilla.org/en-us/docs/javascript_os.file/os.file_for_the_main_thread or create object window.createobjecturl . then assuming file submit dialog prompted html5 uploader, should set value of html5 dialog box there other ways though too, mozsetdataat, mozsetfilearray etc, search github these keywords shows excellent examples: https://github.com/search?l=javascript&q=mozsetdataat&type=code&utf8=%e2%9c%93 https://github.com/search?l=javascript&q=mozsetfilearray&ref=searchresults&type=code&utf8=%e2%9c%93 you might need use mimetype of application/x-moz-file not sure. experiement , share solution, , ask along way. fun stuff. there other smarter wa

html5 - How to centralize the left nav -

i having problems trying centralize bootstrap standard nav in row. <footer id="page_footer"> <div class="container"> <div class="row"> <div class="col-md-8"> <ul id="page_footer_links" class="nav nav-pills nav-center"> <li role="presentation"><a href="#">home</a></li> <li role="presentation"><a href="#">profile</a></li> <li role="presentation"><a href="#">messages</a></li> </ul> </div> <div class="col-md-4"> <p id="page_footer_wordpress" class="text-center">orgulhosamente movido com <a href="http://wordpress.org/" title="a semantic personal publishing platform" rel="gener

html - how to have use own jade file for webpack? -

i'm new webpack , trying figure out how use own html file in webpack-dev-server, webpack build. in app.js have: require('!jade!index.jade') but not make index.html expect. instead, seems @ best can string output of html, isn't want: var jade = require('!jade!index.jade') jade() //outputs html how output index.html file? how webpack-dev-server use html file? i should mention jade file reference stylus files i use jade-html-loader following entry in webpack.config.js : entry: ['./src/app.js', 'file?name=index.html!jade-html!./src/index.jade'] you need npm install --save-dev file-loader jade-html-loader jade

javascript - How to go from .prj file information to the appropriate d3 projection code? -

i learning d3.js , 1 thing struggle projection. i working on map of new zealand following .prj information: rojcs["nzgd2000_new_zealand_transverse_mercator_2000", geogcs["gcs_nzgd_2000",datum["d_nzgd_2000",spheroid["grs_1980",6378137,298.257222101]], primem["greenwich",0],unit["degree",0.017453292519943295]],projection["transverse_mercator"], parameter["latitude_of_origin",0],parameter["central_meridian",173], parameter["scale_factor",0.9996],parameter["false_easting",1600000], parameter["false_northing",10000000],unit["meter",1]] how can use information (i assumed information need there) write projection code in d3.js? except fact should use transversemercator() method, else still confusing me. with minimal code: var projection = d3.geo.transversemercator() .scale(50); i display inconsistent mix of lines moment.

python - Selecting rows if at least values in one column satisfy a condition using Pandas any -

i have following data frame: import pandas pd df = pd.dataframe({ 'gene':["foo","bar","qux","woz"], 'cell1':[5,0,1,0], 'cell2':[12,90,13,0]}) df = df[["gene","cell1","cell2"]] which looks this: gene cell1 cell2 0 foo 5 12 1 bar 0 90 2 qux 1 13 3 woz 0 0 what want select rows based on if @ least 1 value 2nd column onwards greater 2. yielding this: gene cell1 cell2 0 foo 5 12 1 bar 0 90 2 qux 1 13 i tried doesn't give me want: df[(df.values > 2).any(axis=1)] what's right way it? you should select cell1 , cell2 , check them against 2 . example - in [4]: df[(df[['cell1','cell2']] > 2).any(axis=1)] out[4]: cell1 cell2 gene 0 5 12 foo 1 0 90 bar 2 1 13 qux

time series - How do I do a scatter plot with dygraph in R, including mouseover date? -

Image
i have 3 set of data, both in same time series, want plot data set 1 x axis , data set 2 , 3 y axis. data set 2 , 3 in separate plot. in addition, when mouse on data point, see date of data point well. use dygraph/tauchart in r this. another point zooming of graph well. this example of data points in xts format. series 1 series 2 series 3 jan 2006 28397 7.55 11376 feb 2006 21255 7.63 8702 mar 2006 24730 7.62 10011 apr 2006 18981 7.50 7942 may 2006 25382 7.47 10490 jun 2006 23874 7.53 10156 example have seen plot scatter plot no code shown edited: have done scatter plot, there still edit problem it. package used tauchart. i cannot combined series 2 , 3 2 plot(top , bottom) separately the plot not scalable on y axis. tried using auto_scale in tau_guide_x , y, however, x scale works not y. have tried using min , max, not working too. code scatterplot1<-tauchart(a) %>% tau_point("se

c# - Cannot access a non-static member of outer type XXX via nested type with a third-party provided class -

this problem has been addressed in sof in general. however, unable (not competent enough) apply suggestions example. getting "cannot access non-static member of outer type 'fixclienttest.form1' via nested type ... " error. in case, nested type instantiation of 3rd party provided class (in case, open-source quickfix/n library). understand source not relevant trying avoid suggestion might have me modifying code , don't have knowledge around problem. goal update form controls based on information in callbacks library. (the code below simple form 2 buttons, 1 set event callbacks , other stop them.) appreciate suggestions community might have. thank you. using system; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using quickfix; namespace fixclienttest { public partial class form1 : form { public form1() { initializecomponent(); } public class myquickf

ruby - Rails: default serializers and safe_params to all fields in the model -

this question has answer here: rails 4 strong parameters : permit attributes? 1 answer in rails / angular app passing data front-end via rails serializers, , permitting updates fields via params.permit. i understand part of purpose of serializer/safe_params control comes , goes server. however, models, finding need include fields. is there metaprogramming or other method body of serailizer , safe_params can simple expose / accept fields on model, including virtual fields? example code serializer class batchserializer < activemodel::serializer attributes :id, :description, :details, :user_id, :name, :dataset, :dataset_id, :pairs_per_sequence, :pairs_per_bp, :batch_type, :overlap_size,

ruby on rails - Pundit Authorization for Basic Proposal Class -

i trying add authorization via pundit proposal class. i have creation of proposals, etc set have several states aasm_gem proposals. drafted, published , closed. i want users own proposal able view drafted proposal. on publish users should able view proposal. how go creating pundit policy achieves this? not able quite understand documentaiton. if can see 1 example should able figure out. i trasition between states on show page: <%= button_to 'publish proposal', proposals_publish_path(@proposal), method: :put, class:"pull-right btn btn-primary btn-lg", style:"color:white; border: 0px; margin-top:15px;" %> i installed pundit , ran generator. i don't know aasm_gem you're referring to, description, work (i'm making published? , draft? methods since don't know actual api you're dealing with) def show? return true if record.published? return true if record.draft? && user.id == record.user_id fals

css - Bootstrap 3: Collapsable Menu's z-Index -

my test site @ link ... when page width below 768px, how navicon menu show above else? following navbar , colornavbar css files: ---start navbar.css-- /* <nav> tag, classes: navbar & navbar-default */ .navbar{ display: block; margin-bottom: 20px; } .navbar-default{ background:#317ca2; background:-o-linear-gradient(top, #3f94bf, #246485); background:-ms-linear-gradient(top, #3f94bf, #246485); background:-moz-linear-gradient(top, #3f94bf, #246485); background:-webkit-gradient(linear, left top, left bottom, color-stop(0, #3f94bf), color-stop(1, #246485)); background:-webkit-linear-gradient(#3f94bf, #246485); background:linear-gradient(top, #3f94bf, #246485); -moz-box-shadow:0 1px 5px rgba(34,34,34,0.5); -webkit-box-shadow:0 1px 5px rgba(34,34,34,0.5); box-shadow:0 1px 5px rgba(34,34,34,0.5); width:100%; max-width:none; height:50px; margin:0; padding:0; border-bottom:1px solid #1b5572; c

groovy - How do make grails datePicker '0000-00-00 00:00:00' by default, instead of inserting blank or null? -

i using g:datepicker , , in default selection in database inserting null, want insert '0000-00-00 00:00:00'. <g:datepicker name="doseonedue" precision="day" noselection="['':'-choose-']" value="${immunizationinstance?.doseonedue}" relativeyears="[-2..5]" default="none"/> well, never tried (and not have grails environment @ work today) try like class mydomain { date adatefield static constraintes = { adatefield blank: false, defaultvalue: calendar.set(0,0,0,0,0) } i not know if work date starts 1970 computers.

php - Omit folder name from browser URL via htaccess -

i using shared hosting, linux, cpanel, low-end account, no shell access. i wish have website, http://example.com , located entirely inside subfolder, this: /public_html/sub/example at moment, using following .htaccess code redirect visitors folder: rewriteengine on rewritecond %{http_host} ^(www.)?example.com$ rewritecond %{request_uri} !^/sub/mainsite/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /sub/mainsite/$1 rewritecond %{http_host} ^(www.)?example.com$ rewriterule ^(/)?$ sub/mainsite/index.php [l] the problem uri displayed in address bar reflects this: example.com/sub/mainsite/ i address bar this: example.com example.com/anotherpage // <--- .php extension removed how can using .htaccess ? do need second .htaccess file inside /sub/mainsite folder? say?

mysql - get different result using select * and select askid -

that sounds wired,i find when try optimize limit . askid pk , table has 1.14m rows. can not give table because it's in production environment. i try select askid ask limit 1000000,1; return 1001747 then try select * ask limit 1000000,1; return 1000627 askid has index , influence result, think result should same,isn't it? select askid ask order askid limit 1000000,1; return 1000627 . but why order by matters?is there wrong askid index? the performance different. first 1 takes 0.2s ; second takes 2s ; third 1 takes 1s ; how optimize , right result? the mysql version use 5.6.10 sql makes no guarantees in regards row order, chooses whatever makes best plan based on query. if expect order, specify using order by . , should if you're limiting result set.

alphabetical - How to print (Turkish) alphabet with C# and NCLDR? -

cldr set of xml files, contains character sets ncldr library https://github.com/guysmithferrier/ncldr here expected result 29 letters - https://en.wikipedia.org/wiki/turkish_alphabet how print these characters? there similar questions, comments suggest various problems , no solutions. some of say, simple homework task. if so, please go answer how enumerate localized alphabet in c#? generating array of letters in alphabet .net string comparison collation use custom encoding or add custom characters https://stackoverflow.com/questions/26520088/the-right-way-to-use-custom-encoding-class-in-c-sharp

forms - No params being posted to Rails controller -

i have form in app nested fields. i'm using simple_form_for , bootstrap, slim , rails 4.2 , form backing object described here here's proof params missing on server side (n.b. have checked authenticity_token field in markup) this log started post "/example_sentences/9/breakdowns" ::1 @ 2015-08-31 12:37:57 +0900 activerecord::schemamigration load (18.8ms) select "schema_migrations".* "schema_migrations" processing breakdownscontroller#create html parameters: {"example_sentence_id"=>"9"} can't verify csrf token authenticity switching off csrf protection try , debug gives this: started post "/example_sentences/9/breakdowns" ::1 @ 2015-08-31 13:00:05 +0900 processing breakdownscontroller#create html parameters: {"example_sentence_id"=>"9"} user load (24.1ms) select "users".* "users" "users"."id" = $1 order "users".&q

How to make Logstash multiline filter merge lines based on some dynamic field value? -

i new logstash , desparate setup elk 1 of usecase. have found question relevent mine why won't logstash multiline merge lines based on grok'd field? if multiline filter not merge lines on grok fields how merge line 2 , 10 below log sample? please help. using grok patterns have created field 'id' holds value 715. line1 - 5/08/06 00:10:35.348 [baseasyncapi] [qtp19303632-51]: info: [714] cmdc flowcxt=[55c2a5fbe4b0201c2be31e35] method=contentdetail uri=http://10.126.44.161:5600/cmdc/content/programid%3a%2f%2f317977349~programid%3a%2f%2f9?lang=eng&catalogueid=30&region=3000~3001&pset=pset_pps header={} line2 - 2015/08/06 00:10:35.348 [baseasyncapi] [qtp19303632-53]: info: [715] cmdc flowcxt=[55c2a5fbe4b0201c2be31e36] method=contentdetail uri=http://10.126.44.161:5600/cmdc/content/programid%3a%2f%2f1640233758~programid%3a%2f%2f1073741829?lang=eng&catalogueid=30&region=3000~3001&pset=pset_pps header={} line3 - 2015/08/06 00:10:35.349 [tw

PHP for loop not working with jQuery API (Uncaught TypeError) -

Image
so have array full of youtube video id's i'm trying load jquery. reason it's not working, it's giving me error in console: code: <script type='text/javascript'> $(document).ready(function() { <?php $videos = array("vgh5dv0d3wk", "6y_njg-xoee", "9q31j3mkcky"); ($i = 0; $i < count($videos); $i++) { ?> // ----------- $.get( "https://www.googleapis.com/youtube/v3/videos", { part: 'snippet', key: 'aizasydywpzlevxaui-ktsvxtlrolyheonuf9rw', id: '<?php echo $videos[$i]; ?>', }, function(data) { $('#playlist-item-<?php echo $i; ?>').text(data.items[<?php echo $i; ?>].snippet.title); }); <?php } ?> }); </script> the response having 1 item. don't have increment array index.

python - Copy file to file server with authentication -

i using python shutil.copy() method copy file file server earlier there no credentials or authentication required. there change in ldap server requires authentication copy file. shutil.copy(file_path, target) is there anyway copy file file server without mounting. required windows pc python3.

Installation error for openfire in ubuntu -

i trying install openfire on ubuntu server after installation not able open on http://mydomain:9090/setup/index.jsp . after installation got message "starting openfire: openfire." i have followed following steps. sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get remove --purge openjdk* sudo apt-get install oracle-java6-installer java -version cd /tmp wget -o openfire_3.9.3_all.deb http://www.igniterealtime.org/downloadservlet?filename=openfire/openfire_3.9.3_all.deb sudo dpkg -i openfire_3.9.3_all.deb openfire not activated yet. check with netstat -ntulp output: proto recv-q send-q local address foreign address state pid/program name tcp 0 0 0.0.0.0:22 0.0.0.0:* listen - tcp 0 0 127.0.0.1:3306 0.0.0.0:* listen - tcp6 0 0 :::22 :::*

java - How to avoid null body from entering into next processor in multiple steps -

how can restrict null body entering multiple processor @ 1 common place. in below code instead of putting null body check @ every processor, how can define @ single place ? <choice> <when> <simple>${body} != null</simple> <process ref="processor1" /> <choice> <when> <simple>${body} != null</simple> <process ref="processor2" /> <!-- splitter --> <split> <simple>body</simple> <process ref="processor3" /> </split> </when> </choice> </when> </choice> i suggest leave root all-together, rendering further null checks obsolete. quick , easy way stop route-processing current message setting exchange.route_stop property on exchange object , re

windows - How to you detect when a virtual machine has resumed -

i have application trying use utulize virtual machines kept in suspended mode. clarify suspended mean virtual machine launched , brought state it's booted , suspended, on demand machine brought live withing few seconds (as opposed full boot cycle of several minutes). now virtual machine comes online interface message queue. i've come across difficulty, if suspend virtual machine when virtual machine has open tcp/ip connections e.g. message queue, socket isn't discovered invalid until 30-60 seconds later. wondering if there way handle these type of problems, detecting if virtual machine resumed suspension. a workaround i've had promising results configuring virtual machine without network interface enabled, , keep waiting network interface connected before establishing initial connection. still know there alternatives scenario might better, or tried backup plan.

Does Datomic ship all transactions to all connected peers on "commit"? -

Image
the datomic transactor pushes live changes connected peers maintain live index . does mean all data gets transacted sent peers connected - interested in data or not? or e.g. recent db transaction id? the empirically reached answer: yes, full contents of transactions (and more *) gets streamed connected peers . i confirmed connecting peer a transactor , let either just sit there, staying connected or monitor transactions means of tx-report-queue or monitor transactions , print attribute values of entities modified in transaction concurrent each of above test runs, peer b execute 4 transactions, each transaction change couple of simple properties of single entity, 1 of attributes being 5k random string data, other attributes short strings. wireshark captured tcp connection between peer , transactor, , total byte size of tcp dumps can seen in following table . ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ case tx-report-queue print bytes (

java - How to invoke a webservice using rest assured -

i new rest assured , having troubles using run basic program. created java project , added required rest assured jars. below simple code: import com.jayway.restassured.restassured; import com.jayway.restassured.restassured.*; import com.jayway.restassured.matcher.restassuredmatchers.*; import org.hamcrest.matchers.*; public class restservicetest { public static void main(string args[]) throws exception { // restassured.baseuri="http://restcountries.eu/rest/v1/"; string str=restassured.get("http://restcountries.eu/rest/v1/name/norway").asstring(); system.out.println(str); } } i have added pom.xml file add following dependencies. <dependency> <groupid>com.sun.jersey.jersey-test-framework</groupid> <artifactid>jersey-test-framework-core</artifactid> <version>1.9</version> <scope>test</scope> </dependency> <dependency> <groupid>com.su

digital ocean - Setting up a vagrant with a digitalocean image -

i dont know if should posted here or on stack community please let me know if wrong posting here. how local (i.e. on laptop) vm identical droplet (ubuntu 14.04 - lamp etc) running? does provide provisioner vagrant can replicate setup of droplet? it's handy being able develop on machine, instead of on droplet in cloud. it should possible, never tried myself (as switch ec2) saw there digital ocean plugin, can refer following page https://www.digitalocean.com/community/tutorials/how-to-use-digitalocean-as-your-provider-in-vagrant-on-an-ubuntu-12-10-vps basically need following: install plugin , download base box vagrant plugin install vagrant-digitalocean vagrant box add digital_ocean https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box create ssh keys needed authentication digitalocean. run following command generate ssh key pair: ssh-keygen -t rsa you can accept defaults pressing enter. place ssh private , public keys path

objective c - Error in get file from iCloud in ios -

hi in app have file icloud.. enable icloud working fine in simulator.. when test in iphone, can see icloud files when choose default delegate calls can't data url.. - (void)documentpicker:(uidocumentpickerviewcontroller *)controller didpickdocumentaturl:(nsurl *)url { nsdata *pdfdata = [[nsdata alloc] initwithcontentsofurl:url]; } always getting pdfdata nil. log error error domain=nscocoaerrordomain code=257 "the operation couldn’t completed. (cocoa error 257.)" userinfo=0x17029810 {nsfilepath=/private/var/mobile/library/mobile documents/com~apple~clouddocs/download (2).jpeg, nsunderlyingerror=0x15ea9680 "the operation couldn’t completed. operation not permitted"} i cant figure out.. can please me fix issue.. finally found answer myself.. refer link here - (void)documentpicker:(uidocumentpickerviewcontroller *)controller didpickdocumentaturl:(nsurl *)url { [url startaccessingsecurityscopedresource]; __block nsdata *pdfdata =

java - "Received message is too long" when connecting to SFTP server with JSch -

i wanted download files using ftp server. can through command-line , want same thing using java. code session = jsch.getsession(user, server, 22); session.setpassword(pass); session.settimeout(10000); java.util.properties config = new java.util.properties(); config.put("stricthostkeychecking", "no"); session.setconfig(config); session.connect(); channelsftp channel = (channelsftp) session.openchannel("sftp"); **channel.connect();** channel.disconnect(); session.disconnect(); problem when channel connecting i.e channel.connect , getting error: com.jcraft.jsch.jschexception: 4: received message long: 1619214428 @ com.jcraft.jsch.channelsftp.start(channelsftp.java:242) @ com.jcraft.jsch.channel.connect(channel.java:200) @ com.jcraft.jsch.channel.connect(channel.java:144) @ com.cca.processor.ftpprocessor.main(ftpprocessor.java:54) caused by: 4: received message long: 1619214428 @ com.jcraft.jsch.channelsftp.start(channelsftp.java