Posts

Showing posts from January, 2012

loops - Fetch a URL 100 times using Perl -

the problem met need 1 url (i cannot specific link exactly, link doing request , looks http://link.com/?name=name&password=password& , etc) and need fetch url 100 times in row. can not manually using browser - takes time. is there option run (just run, put link in browser , press enter) link 100 times in row using perl scripting? i have not met before perl , therefore asking directly. google before information , make little script, seems missing in knowledge: #!/usr/bin/perl -w use lwp::simple; $uri = 'http://my link here'; $content = $uri; could please advise me how can finish script? use (simple) for loop. #!/usr/bin/perl use strict; use warnings; use lwp::simple; $uri = 'http://my link here'; $uri 1 .. 100; update: read in comment don't care returned data, i've edited answer remove unnecessary $content variable.

javascript - Knockoutjs error: You cannot apply bindings multiple times to the same element -

i'm trying automatically populate element in existing web page can't change , page uses knockoutjs . input element looks more or less: <input maxlength="8" id="xxx" data-bind="textinput: otcinput" type="tel"> then use knockoutjs attempt unbind textinput , populate input element dynamically whatever value need, do: ko.cleannode($('#xxx')); ko.applybindings({ otcinput: ko.observable("123") // populate myself }); however, leads error you cannot apply bindings multiple times same element ... question why? i'm cleaning node ... or not? there way using knockoutjs see whether there dangling bindings or leftovers in way while trying execute "overriding" ko.applybindings ? i have tried other ways set input value via jquery sendkeys plugin without success i.e. $('#xxx').sendkeys('123'); // nothing happens i tried: $('#xxx').unbind(); $('#xxx').off(); $(...

php - How do i pass my chatroom id to my ajax call? -

i want call id when user select different room. different have different id how let ajax know room have enter? and have use ajax call 2 function php is chatnew.php insert message chatmessage.php load message i have used $chatroomid =$_get['chatroomid']; call id seem no working , error -localhost/pme/main/chatroom.php?chatroomid=1 << how chatroomid here chatrooms.php have use sql statement select chatroom out database <td> <a onclick="poll" href="chatroom.php?chatroomid=<?php echo $row['id'];?>"> <div> <p> <?php echo ($row['name']); ?> </p> </div> </a> </td> this js file function submitchat(){ var message = chatroom.message.value; if(chatroom.message.value == ''){ alret('you didnt input message'); return; } ...

php - MySQL returns one row -

i have php code if ($settings['ht_showlastwinners'] == 'yes') { $query = $db->query('select * ht_history '); if ($row = $db->fetch_array( $query )) { $row['username'] = $db->fetchone('select username members id=' . $row['user_id'] ); $htwinners[] = $row; } $smarty->assign( 'htwinners', $htwinners ); } when on .tpl file use {section name=w loop=$htwinners} <tr> <td>{$htwinners[w].username}</td> <td>{$htwinners[w].bet}</td> <td>${$htwinners[w].win}</td> </tr> {/section} it gives me 1 row. tried print value of htwinners in php page , gives me 1 row, suppose problem code, when "copies" data $ht_history in new $htwinners associating/replacing user id username, fetches 1 row. thanks in advance answers, i'm pratical (not lot) on php...

Error:Execution failed for task ':app:transformClassesWithDexForDebug' in android studio -

i moving projects eclipse android studio. while running 1 of app following error. not able find solution. have enabled multidex well. error:execution failed task ':app:transformclasseswithdexfordebug'. com.android.build.api.transform.transformexception: java.lang.runtimeexception: com.android.ide.common.process.processexception: java.util.concurrent.executionexception: com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command 'c:\program files\java\jdk1.7.0_79\bin\java.exe'' finished non-zero exit value 1 also gradle file below apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion "23.0.3" defaultconfig { applicationid "com.myapp" minsdkversion 9 targetsdkversion 21 multidexenabled true }buildtypes { release { minifyenabled true proguardfiles getdefaultproguardfile('proguard- android.txt')...

How to get php date from MySQL database to javascript? -

i'm new web developer.i have following script ,where in enddate instead of 06:39:00 pm , want time mysql database, insert time 06:39:00 . how can time mysql database script? body please me? the script , <script> var config = { enddate: 'may 28 2016 06:39:00 pm', timezone: 'asia/dhaka', hours: $('#hours'), minutes: $('#minutes'), seconds: $('#seconds'), newsubmessage: 'iftar remaining time up' }; </script> my php code , <?php $date= date("y-m-d"); $sql2=mysql_query("select * `data` `date`='$date' "); $row2=mysql_fetch_array($sql2); ?> ..... ..... <?php $time=$row2['iftar']; ?> i want input $time instead of 06:39:00 pm in enddate you need collect data php pass var...

data binding - Dynamically set attribute on component in html template angular 2 -

i trying set attribute on component if expression true. give me example? what have now: <div [danger]="inarray(choice.likers, user, id)"></div> but not compile. inarray own method returns true or false. see is, if expression returns true, output be <div danger></div> in angular 1 there this: ng-attr-... statement did above. to set attribute use attribute binding : <div [attr.danger]="inarray(choice.likers, user, id)"></div> if want show empty attribute conditionally return empty string or null in inarray() : inarray() { let value; if (isinarray) { value = ''; } else { value = null; } return value; } so attribute empty or danger attribute dont exist. result is: <div danger></div>

php - Doctrine "Like" DQL -

i'm new doctrine , trying figure out dql query. i have 2 entities country , venue. country <?php namespace x\application\model\entity; /** @entity */ class country { /** * @id * @column(type="string",length=2) * @generatedvalue(strategy="none") */ protected $id; /** @column(type="string",length=255,nullable=false) */ protected $name; /** * @return mixed */ public function getname() { return $this->name; } /** * @param mixed $name */ public function setname($name) { $this->name = $name; } /** * @return mixed */ public function getid() { return $this->id; } /** * @param mixed $id */ public function setid($id) { $this->id = $id; } } venue <?php namespace x\application\model\entity; /** @entity */ class venue { /** * @var \ramsey\uuid\uui...

scala - How to find out what happens when I use Monoid for Map in scalaz -

how can find instances of monoid . example, how know if there monoid instance map in scalaz ? , if yes, in source code. i've tried following without success @ implicitly[monoid[map[_, _]]] main.scala:1146: not find implicit value parameter e: scalaz.monoid[map[_, _]] implicitly[monoid[map[_, _]]] ^ compilation failed how can see happens (implicit conversions, …) when execute code repl, like map("a", 1) |+| map("a", 1) there no way find instances of type class. specifically map depends on type of values, because map[k, v] monoid instance needs semigroup[v] instance. you can find code map 's monoid in scalaz.std.map . you can see implicit conversions using reflection : import scalaz.std.map._ import scalaz.std.anyval._ import scalaz.syntax.semigroup._ import scala.reflect.runtime.universe._ showcode(reify { map("a" -> 1) |+| map("a" -> 1) }.tree) // `package`.monoid.tosemigroupops( // p...

php - Session are not working -

hello have created login system not working reason , start session after 1 login , made check if session isset , if session no more 1 hour : this login script on index.php : <?php require 'mysql.php'; if(isset($_session["username"]) && time() - $_session["created"] > 3600){ session_start(); session_unset(); session_destroy(); } if(isset($_session["username"]) && time() - $_session["created"] < 3600){ header('location: main.php'); } if (isset($_post["login"])){ $username = $_post["username"]; $password = $_post["password"]; $stmt = $connect->prepare("select username, password users username=? "); $stmt->bind_param("s", $username); $stmt->execute(); $result = $stmt->get_result(); $rowcount = $result->num_rows; if ($rowcount > 0){ while ($row = $result-...

Combine contents of selected text files with into 1 text file with Mac Automator and Services -

Image
i trying combine contents of selected text files in finder 1 text file, using services context menu , control-clicking on .txt files. i have started new service workflow in automator, added steps think should work (see attached workflow file) , saved file. https://drive.google.com/file/d/0b7x9caduunaqrjhnekljqmnut2s/view?usp=sharing the problem services menu doesn't pop when have text files selected in finder. pops when have pdf files selected in finder, that's no output file doesn't work. any ideas how correct can work selected text files? thanks in advance. ryan here final version. trial had chosen incorrect action ignore:

handler - Laravel 5.2 - customize error "Whoops, looks like something went wrong" -

how can change error page " whoops, looks went wrong. "? want show page 404 inside errors folder handler simple: public function render($request, exception $e) { return parent::render($request, $e); } i assume you're inside of app/exceptions/handler.php public function render($request, exception $e) { return response()->view('errors.custom'); }

android - Inject <link> and <script> in webview -

@override public void onpagefinished(webview view, string url) { super.onpagefinished(view, url); view.loadurl("javascript: function(){" + "var newlink = document.createelement('link');" + "newlink.setattribute('rel', 'stylesheet');" + "newlink.setattribute('href', 'http://maven.com/slide/caca.css');" + "document.getelementsbytagname('head').item(0).appendchild(newlink);" + "}"); } but thing won't run ok. expecting webview download css , set in page. basically want add remote css , js files webview. any ideas on how accomplish this? don't want manually download content of files, cache them or whatnot, , set them in webview. apparently works. not entirely sure why though ... view.loadurl("javascript:(function() { " ...

how to restore a PDF file that's been printed 2 pages per page? -

gday there, know simple way of doing this? i.e. printed normal pdf file 2 up, or 2 pages per page. sit side side, 100 page document 50 pages of 2 per page. now want restore original pdf file. thanks in advance! , yes, i've searched here :)

c# - Take user input and use it as Process -

so basically, have openfiledialog user select location. made display directory in textbox. want have button take directory , start using processstartinfo . openfiledialog, showing in textbox: public void button4_click(object sender, eventargs e) { openfiledialog ofd = new openfiledialog(); ofd.title = "open arma 3"; ofd.filter = "exe file|*.exe"; if (ofd.showdialog() == system.windows.forms.dialogresult.ok) { textbox1.text = ofd.filename; } } process: private void button3_click(object sender, eventargs e) { processstartinfo startinfo = new processstartinfo(); startinfo.filename = //result openfiledialog should here startinfo.arguments = @"-window -usebe -mod=e:\aaron\addons\@cba_a3"; process.start(startinfo); } since save result of openfiledialog in textbox1, can access in button3_click event handler. to fill startin...

python - How do I make a stopwatch that continues to run even after closing the application? -

i'd create stopwatch of-sorts records duration elapsed specific moment in time. save database. when close application , reload application i'd able see time elapsed since specific moment in time timer initiated. i'd able see days elapsed well. best way of going this? you can put timer code in thread, work deamon , , record time: class timethread(threading.thread): stop = 0 def __init__(self): threading.thread.__init__(self) def run(self): # here code timer #you can put condition insert db! def stop(self): self.__stop = true print 'in stop' self.stop = 1 to start thread, in background deamon, this: f_thread = timethread() f_thread.start()

Insert Value From One Table to Another on Update MySql, PHP -

i wondering if there way take 1 value column in table , add column in table. the scenario: have table (shopping_cart). stores of customers shopping cart items in columns customerid , pid , price , status (status can "in_cart" means added , "open" means has been paid , ready processed , shipped). have table (products). stores product information in columns pid , price , weight`. when customers place item in shopping cart not capture price. prices can change daily if add today, when come tomorrow price may increase or decrease in shopping cart. when customer checks out , payment confirmed, trying grab price in (products) table products.pid = shopping_cart.pid , apply price shopping_cart.price lock in final price since customer has paid it. ideas? got set change items customers cart "open" little lost on getting script grab value 1 table , applying table. below php script changing lines "in_cart" "open". if($the_function=="cl...

c# - With ServiceStack 3.9.56 cannot find the namespace ServiceStack.ServiceClient.Web -

using nuget package manager added servicestack clients package c# project. tried add namespace reference "using servicestack.serviceclient.web" class namespace isn't available. i've removed servicestack packages nuget, compiled project , added them again, namespace servicestack.serviceclient.web isn't found. have separate project uses servicestack 3.9.49 , exact same nuget packages [id: servicestack.text & servicestack.common] , namespace available in version. as new project, neglected change target framework client profile full/complete profile. once made change, , compiled app, namespace available. thanks.

jquery - Assign 2 actions to one html button -

im trying assign 2 actions 1 button in webpage: send message arduino run server change color of button toggleclass can see if it's on/off code: function autoon() { $('#content').load('/arduino/autoon'); $("button#autoon").click(function () { $(this).toggleclass("selected"); }); } now color of buttons change need click button 2 times change color. why don't change button's class inside autoon function? $("#autoon").toggleclass("selected"); so autoon function become: function autoon() { $('#content').load('/arduino/autoon'); $("#autoon").toggleclass("selected"); }

Determine class of every input argument in R function -

consider having function, accepts number of arguments: fun <- function(...) { #/some code/ } how determine classes of input arguments function fun ? library(ggplot2) g <- qplot(mpg, wt, data = mtcars) char <- "lalala" df <- data.frame(ch) f <- function(x) x*x fun(g, char, df, "df", list(), f, `%in%`, null, true, "true") possibly this: fun <- function(...) { elipsis <- list(...) print(sapply(elipsis, class)) ##/some code/ } however, must make sure passing in sensible thing. example: fun("lalala", trees, "df", list(), function(x) x * x, `%in%`, null, true, "true") # [1] "character" "data.frame" "character" "list" "function" # [6] "function" "null" "logical" "character"

Which Java IO class is better to use for a simple shell interpreter? -

i new java io library, have trouble choosing right class purposes. write simple shell client file transferring server. client should understand 3 commands: list files in remote directory (optionally can take nested directory path argument), download specified file (with file path required argument) , end session (a separate command). concerned handling user's input @ moment. questions are: should read whole line of input, tokenize , logic, or better tokenize input comes , make immediate decisions based on it? what class should use tokenize input: scanner or streamtokenizer? or taking account commands simple use bufferedreader read line, split string "\\s+" pattern? the questions may seem subjective in way want diminish confusion , understand specific use cases of io classes. considering commands basic, reading whole input , tokenizing require lot of efforts. better tokenize input , take decisions required. i think bufferedreader sufficient serve ...

python - NoneType Error with Function -

first, sorry bad english. have problem, function return me nonetype error when executed more 2 time def random(k, position, impossible): """permet de générer des case où il n'y pas encore de navires placé et qui soit possible (éviter que le bateau soit sur deux lignes), l'argument k correspond au navire en cours de placement """ global cases_occupées_bot case = randint(0,99) print("salut !", k, position, case, impossible) if k == 0: #porte-avion (5 cases) if (position == 0 , len(set((case, case)).intersection(set(impossible))) == 0 , len(set((case, case+1, case+2, case+3, case+4)).intersection( set(cases_occupées_bot))) == 0): cases_occupées_bot.extend([case, case+1, case+2, case+3, case+4]) return case elif (position == 1 , len(set((case, case)).intersection(set(impossible))) == 0 , ...

matlab - Saving arrays of every iteration of for loop -

i have following matlab code: clc; clear all; close all; format long; d=717; r1=60000; r2=[61043; 62000]; rx=[0; 10]; ry=[11.212; 1]; k=-1.000953; o=1:1:size(rx) i=1; rho1=0:17.7:d theta=0:10:360; rho=rho1; x(i)=rho.*cosd(theta)+(rx(o)*1000); y(i)=rho.*sind(theta)+(ry(o)*1000); xx(i)=(((x(i))-(rx(o)*1000))/d); yy(i)=(((y(i))-(ry(o)*1000))/d); l(i)=sqrt(x(i).^2+(y(i)).^2); c1=1/r1; s11(i)=c1*(l(i).^2); s12(i)=1+(sqrt(1-(1+k)*c1*c1*(l(i).^2))); s1(i)=s11(i)/s12(i); %hyperbola sag s2(i)=(r2(o)-sqrt((r2(o).^2)-(l(i).^2))); %best fit sag m(i)=abs((-s1(i)+s2(i))); i=i+1; end end dz=m'; xn=xx'; yn=yy'; z=[dz xn yn]; end after each iteration of loop, arrays dz , xn , yn , , matrix z modified. how save output of every iteration? you can use concept of multidimensional arra...

javascript - Accessing single field from object in array -

i'm using meteor mongodb , can't seem figure out how access single field objects in object array. my documents: { "_id" : "p6c4cstb3chwajqpg", "createdat" : isodate("2016-05-11t11:30:11.820z"), "username" : "admin", "contacts" : [ { "when" : isodate("2016-05-11t11:30:32.350z"), "who" : "4ybufbe9pbyjbkasy" }, { "when" : isodate("2016-05-25t11:52:49.745z"), "who" : "z792keeybxyzyeakp" }, { "when" : isodate("2016-05-26t13:47:43.439z"), "who" : "4ybufbe9pbyjbkasy" }, { "when" : isodate("2016-05-26t13:48:22.828z"), "who" : "4ybufbe9pbyjbkasy" } ] } i w...

javascript - I cant get user details to save properly in a session -

i trying create chat box , cant user_id save in session after logging in , saving in database. this login function public function login() { $this->form_validation->set_rules('email', 'username', 'trim|required|xss_clean'); $this->form_validation->set_rules('password', 'password', 'trim|required|xss_clean'); if ($this->form_validation->run() == false) { // return main page if submitted form invalid. $this->load->view('abt_login'); } else { $this->load->model('abt_db'); $q = $this->abt_db->check_login( $this->input->post('email'), $this->input->post('password') ); if ($q) { redirect('index.php/abovetheblues/abt_abovetheblues'); $this->abt->set_session(); } else { $this->show_login(true); } } } t...

javascript - How to extract Ajax returned info in this particular code? -

i have code in client side: this.formvalidation = function() { // parse forms $('.submit.btn').on('click', function(){ $(this).closest('form').submit(); }); $.each($('form.validate'), function(){ $(this).validate({ submithandler: function(form) { var data = $(form).serializearray(); var action = $(form).attr('action'); $.ajax({ method: 'post', datatype: 'json', url: action, data: data, success: function(d) { // prepare message var message = ''; $.each(d, function(k, m){ var messagetype = 'boolean' === $.type(m.status) ? (m.status?'success':...

java - MarkLogic get data from collection -

is possible data marklogic xml database, using marklogic api java? have read documentation, shows how add xml collection or delete it, doesn't show how xml documents 1 selected collection? this looks job https://docs.marklogic.com/javadoc/client/index.html?com/marklogic/client/query/structuredquerybuilder.html structuredquerybuilder.collectionconstraintquery collectionconstraint(string constraintname, string... uris) matches documents belonging @ least 1 of criteria collections specified constraint.

angular - Error trying to reach github route -

i'm trying change beta router new component router, project started official angular2 seed: https://github.com/angular/angular2-seed so how seed-app.ts looks like: import {component} '@angular/core'; import {router, routes, router_directives} '@angular/router'; import {home} './components/home/home'; import {about} './components/about/about'; import {repobrowser} './components/repo-browser/repo-browser'; @component({ selector: 'seed-app', providers: [], pipes: [], directives: [router_directives], styles: [require('./seed-app.scss')], template: require('./seed-app.html'), }) @routes([ { path: '/home', component: home}, { path: '/about', component: about}, { path: '/github/...', component: repobrowser}, ]) export class seedapp { constructor() {} } and template seed-app: <div class="seed-app"> <h3> angular 2 seed ...

javascript - Cordova - Alter Push Notifications on the device -

i have push plugin enabled on device using this - suppose standard - plugin . can change plugin, however, if solutions involve one. what want receive notifications via push (google gcm now) , alter them on device before showing them (mainly translation specific locale). i assumed using push notification plugin receive notifications (but not show them!) , passing them local notification plugin show altered notification solution. push plugins see automatically show notification. is there way around or else entirely solve problem? you can implement silent push notifications, in case no notification displayed.

javascript - Cannot understand the behavior of element.style.color -

in following code color of element para1 set green means of internal styling @ beginning. if click on buttons first time "console.log(elem.style.color)" inside "function changecolor" not return color green. second time , on color of element returned. function changecolor(newcolor) { var elem = document.getelementbyid("para1"); console.log(elem.style.color); elem.style.color = newcolor; } .mypara1{ color: green; } <p id="para1" class="mypara1">some text here</p> <button onclick="changecolor('blue');">blue</button> why color set internal styling not returned? the reason elem.style returns style directly applied on dom element (e.g. in html, or through elem.style ), not style resulting css selector. if want computed style, takes account css rules, need use window.getcomputedstyle . note result may different has been entered (e.g. chrome, colors gi...

bash awk extract and sum values from one numeric col -

i have data in file: $ cat data.txt facture-2817806.txt total ttc 27.11 € facture-2857125.txt total ttc 37.92 € facture-2895824.txt total ttc 43.61 € facture-2922275.txt total ttc 46.73 € facture-2935969.txt total ttc 8.29 € facture-2977623.txt total ttc 41.79 € facture-3005553.txt total ttc 46.18 € facture-3020047.txt total ttc 20.34 € facture-3061124.txt total ttc 28.22 € facture-3097529.txt total ttc 59.65 € facture-3258989.txt total ttc 29.31 € facture-3637195.txt total ttc 11.17 € facture-3681794.txt total ttc 44.52 € facture-3726992.txt total ttc 28.20 € facture-3752273.txt total ttc 42.15 € facture-3770970.txt total ttc 24.01 € i want sum float value of 1 col, extract column: $ cat data.txt | awk '{print $4}' 27.11 37.92 43.61 46.73 8.29 41.79 46.18 20.34 28.22 59.65 29.31 11.17 44.52 28.20 42.15 24.01 $ what bash way sum of 1 more pipe '|' ? $ cat data.txt | awk '{print $4}' | xxx note: there similar issue here: why awk refuse sum floats...

npm - Cannot find module 'npmlog' -

hello receive following message when trying install npm. downloaded recent node.js doesn't seem download npm. keep getting below enter code here error message after deleting node.js , reinstalling it. when try installing node.js don't see following being created: c:\users\efren barragan\appdata\roaming\npm this first time installing node.js. installed on old computer , worked out fine. new so patience appreciated! thanks! c:\users\efren barragan> npm install npm -g module.js:327 throw err; ^ error: cannot find module 'npmlog' @ function.module._resolvefilename (module.js:325:15) @ function.module._load (module.js:276:25) @ module.require (module.js:353:17) @ require (internal/module.js:12:17) @ c:\users\efren barragan\appdata\roaming\npm\node_modules\npm\bin\npm-cli.js:19:13 @ object.<anonymous> (c:\users\efren barragan\appdata\roaming\npm\node_modules\npm\bin\npm-cli.js:75:3) @ module._compile (module.js:409:26) @ object.module._extensions.....

android - Parsing JSONArray and populating it in a ListView -

following activity supposed take values (users) json, , put them in arraylist<user> user class created. after doing supposed fill listview these values. problem every time try open activity, crashes. can please tell me problem? , class works purpose want? public class search extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_search); } public void onclick(view v) { switch (v.getid()){ case r.id.imagebutton2: new storeuserdataasynctask().execute(); break; } } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.menu_searchh, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item c...

c++ - How can I get the address of scoped_ptr? -

i'm studying smart pointers, in particular scoped_ptr . read operators * , -> . tried run code: int main(){ boost::scoped_ptr<int>number(new int); *number = 432; std::cout<<"value: "<<*number <<std::endl<< " adress: "<< number <<std::endl; return 0; } and result is: value: 432 adress: 1 that isn't correct. how have use -> operator correct address? use get() member function: boost::scoped_ptr<int>number(new int); *number = 432; std::cout<<"value: "<<*number <<std::endl<< " adress: "<< number.get() <<std::endl; more details here

javascript - ngModel does not update parent object -

i try make directive using requires ngmodel manage coords object ( {x: number, y: number} ). my problem when update value of in directive, works fine directive, parent scope data comes not updated. in directive here content of link function (only part manages ngmodel) : ngmodel.$render = function() { console.log('render'); scope.top = ngmodel.$viewvalue.top; scope.left = ngmodel.$viewvalue.left; }; // transform model value view value // have x, y coords (of center) , need transform them top, left position ngmodel.$formatters.push(function(modelvalue) { console.log('> view'); if (modelvalue) { return { top: modelvalue.y - scope.pointer.size / 2, left: modelvalue.x - scope.pointer.size / 2 }; } return modelvalue; }); // transform view value model value // have top, left position , need transform them x, y coords (of center) ngmodel.$parsers.push(function(viewvalue) { console.log(...

python - JSON dump breaks my dictionary when using certain characters -

dumping data file json.dump. data looks this: {"hello": {"this": 1, "a": 1, "is": 1, "test": 1}} the code use achieve follows (worddict file, file.json): with open(words, 'w') fp: json.dump(worddict, fp) fp.close() i'd have data in format: { "hello": { "a": 1, "is": 1, "test": 1, "this": 1 } i changed code this: with open(words, 'w') fp: json.dump(worddict, fp, sort_keys=true, indent=4, separators=(',', ': ')) fp.close() and works, until try dump characters "Á", "É", "Ű"... these characters breaks worddict file, , when cat file looks this: { any idea why? replace json.dump(worddict, fp, sort_keys=true, indent=4, separators=(',', ': ')) with json.dump(worddict, fp, sort_keys=true, indent=4, separators=(',', ': '), ensure_a...

ios - Very poor performance after dismissViewController -

i have view controller presents 1 modally contains gif , table view animation on cells, , when dismiss it, app has annoyingly long delay before can again (like 3-5 seconds). i've found answers it's because still have reference vc after dismissal, don't see how that's possible because place make reference in prepareforsegue. any suggestions? edit 1: here prepareforsegue : override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { let destvc = segue.destinationviewcontroller as! inworkoutviewcontroller destvc.workout = workout } the destvc's workout property optional custom class. edit 2: here how vc dismissed (still slow): @ibaction func tappedx(sender: anyobject) { dispatch_async(dispatch_get_main_queue(), { [unowned self] in self.dismissviewcontrolleranimated(true, completion: nil) }) }

linux - Create tar.gz archive and add all files and folders without parent folder -

for example have folder "admin" contains folder "1" , 2 php files "index.php" , "page.php". try use tar -zcvf admin.tar.gz admin , got admin.tar.gz archive. if open archive, can see archive contains "admin" folder , inside directory folder "1" , 2 php files. i want create tar.gz archive files , folders, without parent folder. create archive , contains folder "1" , 2 php files. how can it? you can use -c option: tar -c admin -zcvf admin.tar.gz . see man tar -c, --directory=dir change dir before performing operations. option order-sensitive, i.e. affects options follow.

java - action.keyDown(Keys.CONTROL).sendKeys("j").keyUp(Keys.CONTROL).build().perform(); does not work if the test browser is not under focus of the OS -

i using java , selenium write tests chrome. need open download page @ 1 point used code below: action.keydown(keys.control).sendkeys("j").keyup(keys.control).build().perform(); and works long os focus on test browser, mean if run test , go , click somewhere else (for example if start coding in ide while test running) code wont work. how can bring focus test browser or other way code works , download window open on test browser? the interesting point works for: action.keydown(keys.control).sendkeys("a").keyup(keys.control).build().perform(); if it's not focused!!! if goal clear downloads, , cannot start chromedriver fresh state, can try following: driver.get("chrome://downloads/"); ((javascriptexecutor) driver).executescript("chrome.send('clearall');");

php - How can I use API to get quickbooks data without browser based OAUTH? -

this in relation online version of quickbooks, qbo (not desktop). we need our serverside code able log-in , query data quickbooks (just api provides) , supply information our billing system. not involved browser , use curl means there no browser , no human 'log in' , 'request access' each time. have not found way yet. ideas? your question answered on here: https://intuitpartnerplatform.lc.intuit.com/questions/767273-how-can-i-use-api-to-get-quickbooks-data-without-browser-based-oauth alas, sake of verboseness: no matter api choose, can you're asking. regardless of api go (qbxml, or intuit anywhere/oauth) need human things connected the first time connect . after first time, can fetch data @ time want (as suggest, curl) 0 interaction actual user. have store oauth credentials intuit gives you. how oauth implementations work - store credentials back, can request data unattended later. if that's not behavior you're seeing, means you...

excel vba - compare values in two cells even if the values are not in same order -

Image
i have 2 columns , b. value in cell a1 "abc, def, ghi" , value in cell b1 "ghi, abc, def". cells contain same values . however, not in same order . if a1=b1 used false. how right . try following user defined function: public function samestuff(s1 string, s2 string) boolean dim bad boolean samestuff = false ary1 = split(replace(s1, " ", ""), ",") ary2 = split(replace(s2, " ", ""), ",") if ubound(ary1) <> ubound(ary2) exit function each a1 in ary1 bad = true each a2 in ary2 if a1 = a2 bad = false next a2 if bad = true exit function next a1 samestuff = true end function for example: note: the space character discarded there can more 3 items in each cell. true means items in b1 permutation of items in a1

java - Rename a known file using a list of string from a .txt file -

i'm trying write code lets me rename specific file (with known name , directory) using txt file has inside list of names. specificly, want rename episode using txt file has names of episodes in season. this code wrote: main class: import java.io.ioexception; public class main { public static void main(string[ ] args) throws ioexception { string file_name = "c:/users/home/desktop/friends season 2 titles.txt"; try { readfile file = new readfile (file_name); string[] arrlines = file.openfile(); int i; /*for ( i=0; < arrlines.length; i++ ) { // perhaps i'll use loop later on... system.out.println( arrlines ) ; } */ renamefile newfile = new renamefile (); string file2_name = "c:/users/home/desktop/friends_s02e01_720p_bluray_sujaidr.mkv"; newfile.renamesinglefile(ar...

awk - Delete multiple lines - from "patternA" match, through second occurrence of "patternB" -

i'd use sed or similar tool find line containing " something? " , delete line , following lines until second occurrence of line containing " fi ". example... if have following file /somepath/somefile containing: ... # test something? if something if somethingelse somethingelse fi fi ... and i'd find , remove lines, starting line containing " something? " through line containing second " fi " i'm able remove lines starting line containing " something? " through end of file using sed -n '/something?/q;p' i'm not sure how add condition stop after second line containing " fi ". appreciated. you awk: awk 'begin { del=0 } /test something?/ { del=2 } del<=0 { print } /fi/ { del -= 1 }' your-file

c# - UWP check the current page for name or instance -

in uwp app launching protocol or toast. in onactivated method want check whether apps' mainview open or page showing. app.xaml.cs i wanna like: if mainpage not showing --> navigate(typeof(mainpage)); or if main window not open since coming protocol or toast launch open frame , navigate mainpage. not sure how go it. so i'm checking for var frame = window.current.content frame; if (frame != null) { type whatpageisit = frame.sourcepagetype; // handle page type } else { // need in case window not open }

unable to render index or mobile page with spring mobile -

Image
i able project run fine until brought in spring-mobile. strings return in browser spring-mobile method returning: @controller public class devicedetection { private logger logger = loggerfactory.getlogger(devicedetection.class); @requestmapping(value="/index") public string detectdevice(device device) { if (device.isnormal()) { system.out.println("inside isnormal()"); return "index"; } else if (device.ismobile()) { system.out.println("inside ismobile()"); return "mobilepage"; } else if (device.istablet()) { return "mobilepage"; } return "index"; } } so decided needed internalresourceviewresolver gives me following error: error creating bean name 'viewresolver' defined in class path resource [org/springframework/boot/autoconfigure/web/webmvcautoconfiguration$webmvcautocon ...