Posts

Showing posts from April, 2015

javascript - Fancybox css issue -

i use fancybox html page can't style link open fancybox. normaly use class style html link fancybox class given fancybox. need change background color of link liks this: background-color: #e9f3d8; here fancybox script use html page <script type="text/javascript"> $(document).ready(function() { $(".contactform").fancybox({ 'width' : 750, 'height' : 420, 'autoscale' : false, 'transitionin' : 'none', 'transitionout' : 'none', 'type' : 'iframe' }); }); </script> and link page looks linke this <a href="../waar-vind-je-ons/contact_form.php" class="contactform">mail</a> hard recreate problem jsfiddle because work fine here <style> { background-color: #e9f3d8; } </style> <script> $(document).ready(function() { $(&

c# - I want to selected data from an XML file where element is empty -

this code have worked out, don't know how put selected data gridview in c#. xdocument doc = xdocument.load(savepath); xelement ele = doc.root.element("boatinslip"); var addsliptogrid = slip in doc.elements("sliplist").elements("slip") slip.element("boatinslip").value == "" select slip; foreach (var slip in addsliptogrid) { //no idea needs come here //(edit) code seemed put 1 char in each cell nullslipgrid.datasource = slip.value; nullslipgrid.databind(); } this xml data. <sliplist> <slip> <dock>dock 1</dock> <slipid>2</slipid> <slipwidth>4</slipwidth> <sliplength>12</sliplength> <boatinslip></boatinslip> <slipheight>12</slipheight> <slipdoor>true</slipdoor> </slip> </sliplist> i w

Subdivide nested dictionary, while applying percentage from values in Python -

i want subdivide dictionary, while applying values (which percentages, value of another. i have sets of data: {'c-std-b&m-sum': {datetime.date(2015, 5, 20): 0.21484699999999998, datetime.date(2015, 5, 21): 0.245074, datetime.date(2015, 5, 22): 0.27874} {'g-cam-bac-sum': {datetime.date(2015, 5, 20): 0.13294399999999998, datetime.date(2015, 5, 21): 0.151648, datetime.date(2015, 5, 22): 0.17248, datetime.date(2015, 5, 23): 0.195664} {'g-cam-bac-xs': 0.06, 'g-cam-bac-xxs': 0.01, 'g-cam-bac-xl': 0.11, 'g-cam-bac-s': 0.19, 'g-cam-bac-l': 0.26, 'g-cam-bac-xxl': 0.03, 'g-cam-bac-m': 0.35} {'c-std-b&m-xl': 0.3, 'c-std-b&m-xxl': 0.11, 'c-std-b&m-s': 0.06, 'c-std-b&m-m': 0.2, 'c-std-b&m-xs': 0, 'c-std-b&m-l': 0.32} expected output: {'c-std-b&m-xl': {d

c - No warnings for headers included by headers in non-current directories -

how can let gcc , clang generate warnings header files included header files in non-current directories? i'm using gcc 4.9.2 , clang 3.6.0. for example, assume ./include_a.c includes ./dir/a.h , ./dir/a.h includes ./b.h , , ./b.h expected generate warning -wconversion ; then, gcc , clang -wconversion not generate expected warning when compile include_a.c . -wconversion -wsystem-headers , expected warning generated, comes many useless warnings system headers. when ./b.h directly included source file in current directory (such ./include_b.c ), expected warning generated without -wsystem-headers . the following shell script reproduces example (the case of clang omitted): #!/bin/sh mkdir dir echo '#include "b.h"' >dir/a.h echo 'void f() {int = 0; char b = a;}' >b.h echo '#include "dir/a.h"' >include_a.c echo '#include "b.h"' >include_b.c set -x gcc -c include_a.c -wconver

html - Processing sketches have stopped working in Chrome and Firefox -

i noticed yesterday. processing sketches on willhay.io have stopped working in google chrome , firefox, however, work fine in safari. haven't changed code strange. console giving me error get http://willhay.io/cdn-cgi/pe/bag2? r[]=http%3a%2f%2fwillhay.io%2fprocessing%2fprocessing.min.js 405 (not allowed) something cloudflare maybe (i've got free version)? check out here: http://willhay.io/processing/trip/ turns out cloudflare , way rocketloader page speed optimizer works. turned off after remembering switched on other day , processing sketches working fine. had way messes javascript , guess processing.js didn't that.

php - MySQL number of threads_connected slow down my website -

Image
i have store running on prestashop 1.5.4. keep having problem site behaviour. everytime check number user@server:~$ mysql -se "show status '%threads_connected%'" if number gets above 25, site becomes slow. opening page takes forever , page load can high 1 - 2 minutes. the solution (temporary) me restart apache services. i pretty sure 25 pretty low number. in case need know, don't have direct access my.ini nor access mysql server configuration. database stored in shared (dbass). i have full access webserver (apache2.conf, php.ini, www.example.com.conf) a little info might help: -se "show variables '%max%'" outputs: i guess question how can improve performance ? can improve limiting number of "threads_connected" ? footnote: i aware there bad query somewhere in code, however, @ moment need quick solution this. reviewing queries can take time. edit #1 perhaps information might give ideas edit #2

ruby - Strange has_many Association Behavior in Rails 4 -

i've got 2 tables, user , allergy . these connected via table, userallergy . models expected: class user has_many :user_allergies has_many :allergies, through: :user_allergies end class userallergy belongs_to :user belongs_to :allergy end class allergy has_many :user_allergies has_many :users, through :user_allergies end what i'm confused creating allergies multiple-valued collection_select in user form. i have following field: <%= f.collection_select :allergy_ids, allergy.all, :id, :name, {}, { class: 'form-control', multiple: true } %> this correctly inserts key params if selected allergies ids 1 , 2: { user: { id: "1", allergy_ids: ["", "1", "2"] } } when create user instantiated @user = user.new( my_params ) , weird behavior occurs. instead of inserting provided

netbeans 8.0.2 doesnt recognize primefaces 5.1 or 5.2 library in jsf framework component -

i'm work on jsf 2.2 ejb 3 project on netbeans 8.0.2 , glassfish 4.1 work primeface 5.0 want use new component primefaces 5.1 or 5.2 try add primefaces 5.1 library directly web project error: tag library supports namespace: http://primefaces.org/ui , no tag defined name: inputswitch that's mean component work on primefaces 5.1 or 5.2 i go web project properties frameworks components primeface click on more create new library add primefaces 5.1 jar file netbeans doesn't recognize recognize primefaces 5.0. so or explain??

android - Different backstack behavior between Nexus 6 device and emulator -

i working on app has support fragment searchview widget , recyclerview present search results sends user fragmentactivity display details of selection. of works fine, i'm seeing inconsistent behavior between nexus 6 emulator , actual device in regards backstack. in emulator, works expect, user being taken search results fragment if pressing button while on details fragmentactivity. on actual nexus 6 device, user taken way appcompatactivity contains app's menu (this activity uses support fragmentmanager , adds fragments manages backstack): private void replacefragment(fragment supportfragment) { string fragmentname = supportfragment.getclass().getsimplename(); supportfragmentmanager.begintransaction() .addtobackstack(fragmentname) .replace(r.id.frame_menu_container, supportfragment, fragmentname) .commit(); } the code send user fragment fragmentactivity intent extras: intent intent = new intent(getactivity(), playerde

javascript - Positioning a Dropdown Where Button Was Clicked -

i have alloy ui dropdown component want render when user clicks on 1 of 4 buttons - dropdown should positioned left of button clicked var toolsdropdown = new y.dropdown({ boundingbox: '#my-div', trigger: '.option', hideonclickoutside: true, hideonesc: true }).render(); i dropdown menu render wherever position of button clicked (imagine these buttons displayed in each row of table) <div id="my-div"> <div id="container-1"> <button id="options-btn-1" class="option" type="button">option one</button> </div> <div id="container-2"> <button id="options-btn-2" class="option" type="button">option two</button> </div> <div id="container-3"> <button id="options-btn-3" class="option" type="button">option three</but

angularjs - Controller running Parse query before scope variable resolved -

i have dashboard has variable x needed throughout application. have factory in dashboard.js listens x 's value change , updates if needed. dashboard.js runs first , resolves x. there several pages have own controllers load after dashboard.js. these pages listen/use variable x . running parse queries in controllers of these pages x showing undefined cannot use in query. how run controller after x defined? assuming relationship between controllers parent-child relationship , variable declared on $scope, childcontrollers should inherit variable. without code , hard tell. either way, use $rootscope make variable accessible. eventhough technically possible , not way want it. then have possibility broadcast/emit , watch , event x changes. can transmit data on event. doing, guess? you create service injected in every controller, regardless of relation, keeps track of variable. or in case, assign functionality factory too. but hard tell without code you're tryin

c# - Command to exit to windows -

i need command exit game, mean, exit desktop or windows (whatever). because i'm doing pause menu , wan't , have button don't have exit command. use c# , work on unity 5 thanks simply have button call application.quit(); , after saving data needs saved.

Create single-file executable and embed static files, for legacy C/Linux program -

i have legacy linux application written c relies upon static external files on filesystem. i'd bundle of them single executable, single-file executable doesn't rely upon in filesystem. there way this, without having make lots of changes existing code? i can link program statically avoid dependencies on dynamic libraries, application relies upon other static resources (other read-only files on filesystem), i'd embed application. know how embed external file final executable using objcopy (e.g., described here or here ), need arrange program use embedded blob instead of trying open file on filesystem. i've seen ways access these elf sections @ runtime (e.g., using linker symbol names or elfdataembed , described here , here ), require me change every place in program accesses 1 of these external files instead refer embedded resource. sounds tedious , error-prone. to reduce workload , reduce bugs, i'd prefer minimize amount of changes needed application

java - Jackson value conversion with lazy serialization -

i want convert 1 java type using objectmapper.convertvalue() . source object of specific type, destination type varies. performance reasons, want avoid serializing source fields not defined on destination type. know deserialization can configured ignore fields, far understand, source fields still evaluated in intermediate serialization. there way create serializer evaluate fields existing on destination type? to put more generally, when converting between java types, can schema of destination type used determine serialization strategy source type? no. say, can make deserializer part ignore properties not recognize, there no functionality trimming content serialized. but sure actual performance issue? intermediate form used ( tokenbuffer ) simple sequence of leaf-values, , since string s exists, overhead should quite low. there no full serialization json involved, regardless.

python - Converting a Text File into a Pyplot -

Image
i have long text file want plot in python. i've imported text file using this: import matplotlib.pyplot plt plt.figure() open('6-18-2015 14.2.9.txt') f: line in f: line = [float(line)] plt.plot(line) every time run code, get: valueerror: invalid literal float(): how solve problem? appreciated. you should have @ pandas . makes such tasks trivial. example: assuming have .csv file named data.csv looks this x, y 1, 1 2, 4 3, 9 ... then can plot follows import pandas pd import matplotlib.pyplot plt df = pd.read_csv("data.csv") plt.plot(df.x, df.y) plt.show() edit: you can transpose 4x10000 data , change 10000x4. here's example showing how plot 10000x4 data using matplotlib. 4ddata.csv x,y,z,u 10.39, 73.32, 2.02, 28.26 11.13, 68.71, 1.86, 27.83 12.71, 74.27, 1.89, 28.26 11.46, 91.06, 1.63, 28.26 11.72, 85.38, 1.51, 28.26 13.39, 78.68, 1.89, 28.26 13.02, 68.02, 2.01, 28.26 12.08, 64.37, 2.18, 28.26 11.58, 60.71,

java - JCheckBoxes not being disabled after I setEnable(false) them -

if have 30 checkboxes , don't want more 6 of them checked. have int keeping track of how many checked. each box has item listener calls method see int at, , if reaches 6, method calls setenabled(false) on each box. however, after int number_of_boxes_checked reaches 6 boxes don't disabled. import java.awt.borderlayout; import java.awt.eventqueue; import javax.swing.jframe; import javax.swing.jpanel; import javax.swing.border.emptyborder; import javax.swing.jcheckbox; import java.awt.gridlayout; import javax.swing.event.changelistener; import javax.swing.event.changeevent; import java.awt.event.itemlistener; import java.awt.event.itemevent; import javax.swing.jlabel; public class jlottery2 extends jframe { private jpanel contentpane; int number_of_boxes_checked = 1; jcheckbox[] checkbox = new jcheckbox[30]; jlabel label = new jlabel("0"); /** * launch application. */ public static void main(string[] args) { eventqueue.invokelater(new runnable() {

android - Why is my graph not showing up? -

i trying use mpandroidchart library in project. how layout , activity code. not showing in layout when run this. sure i'm missing small. it? bugging me why not showing up graph_activity.xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin"> <com.github.mikephil.charting.charts.barchart android:id="@+id/chart" android:visibility="visible" android:layout_width="match_parent" android:layout_height="match_parent" /> </rel

jquery - Float masonary elements to the right instead of stacking -

i have been working off of snippit create masonary style homepage. don't want stack div elements, rather gradually float them right , tile downward. i've seen solution , it's in regards list elements, can't seem work div elements. don't want use jquery plugin handle fyi, want keep pure css. your masonary css property column-width limit size of column , stack divs vertically. if want have divs flow horizontally , overflow vertically, need set item display:inline-block , set fixed width: .item { display: inline-block; padding: .25rem; width: 200px; } code example

c++ - Extracting function argument types as a parameter pack -

this followup question "unpacking" tuple call matching function pointer , asked how provide values std::tuple arguments function in generic way. solution given there following: template<int ...> struct seq { }; template<int n, int ...s> struct gens : gens<n-1, n-1, s...> { }; template<int ...s> struct gens<0, s...> { typedef seq<s...> type; }; double foo(int x, float y, double z) { return x + y + z; } template <typename... args> struct save_it_for_later { std::tuple<args...> params; double (*func)(args...); double delayed_dispatch() { return callfunc(typename gens<sizeof...(args)>::type()); } template<int ...s> double callfunc(seq<s...>) { return func(std::get<s>(params) ...); } }; int main(void) { std::tuple<int, float, double> t = std::make_tuple(1, 1.2, 5); save_it_for_later<int,float, double> saved = {t, foo}; std::cout <&

objective c - SKLabelNode.name target for setText -

question how target sklabelnode name? change it's text? example; sknode *node = [self childnodewithname:string]; [node settext:value]; how 1 achieve this? cannot targeting it's instance variable have multiple under same name, however, have different names. cannot figure out how target sknode. and try , sklabelnode *node =... incompatible. any appreciated, thank you. going through questions , sorting them out. sknode *node = [self childnodewithname:string]; sklabelnode *label = (sklabelnode *)node; label.text = @"dwadw";

android - How can I be notified when a Snackbar has dismissed itself? -

i'm using snackbar com.android.support:design:22.2.0 library. i'm using undo deletions. make life easier, i'm going make ui things deleted data source, , if undo button in snack bar not pressed, perform deletions data source. so, want know when snackbar no longer visible, it's safe delete items. i can call getview() on snackbar, i'm not sure listener should using. tried setonsystemuivisibilitychangelistener() didn't work, believe system status bar. additionally, snackbar can not extended, has private constructor. google design library supports snackbar callbacks in version 23. see snackbar docs , callback docs . notified when snackbar gets dismissed (and when shown) , type of dismissal if useful you: snackbar.addcallback(new snackbar.callback() { @override public void ondismissed(snackbar snackbar, int event) { //see snackbar.callback docs event details ... } @override public void onshown(snackbar snackb

javascript - Reformat Code with Custom Language (Dust.js)? -

i'm trying use automatic reformat code option in jetbrains ide (pycharm pro 4.5), won't work *.dust templates. tried using custom dust plugin ( https://github.com/yifanz/intellij-dust ), adds syntax highlighting. is there no way ide use html code style settings on different file extension or custom definitions created on fly? there not way define generic style definitions. "intelli-dust" plugin developer need add them plug-in. or yo need add own plug-in. reason being defining code style formatting rule complex.

javascript - How to Fetch Coordinate Value (x,y) from jQuery Code and Store in NSString? -

div tag used performing bold , italic , etc. operations in uiwebview . want fetch position coordinates when user touches div tag through javascript/jquery. i found code in jsfiddle . $(document).ready(function(e) { $('#c').click(function(e) { var posx = $(this).position().left, posy = $(this).position().top; var x = e.pagex - posx; var y = e.pagey - posy; alert( (x) + ' , ' + (y)); }); }); #c { width: 100px; height: 100px; cursor: pointer; background: #2f2f2f; position: absolute; top: 50px; color: #fff; font: bold 15px arial; } <div id="c" style="left:500px;"> position() <br /> mouse <br/> position </div> how store x , y coordinates jquery nsstring using string evaluating javascript string? as per uiwebview class reference , need use stringbyevaluatingjavascriptfromstring , return

ios - how to prevent a UITapGestureRecognizer in a background view from being called when clicking on an overlay -

Image
i have background dimmedview uitapgesturerecognizer. however, when click on overlayview, background uitapgesturerecognizer called. intended behavior? putting userinteractionenabled=false on our overlay still has background uitapgesturerecognizer called. how make overlay prevents uitapgesturerecognizer on background view (self.dimmedview) being called. here's code: func renderoverlaynav(){ println("yyy render outlay") self.dimmedview=uiview(frame: cgrectmake(0.0, 0.0, self.screenwidth, self.screenheight)) self.dimmedview.backgroundcolor=uicolor.blackcolor().colorwithalphacomponent(0.5) let dimmedviewtap = uitapgesturerecognizer(target: self, action:selector("tapondimmedview:")) self.dimmedview.addgesturerecognizer(dimmedviewtap) self.modalview=uiview(frame: cgrectmake(50.0, 144.0, (self.screenwidth-100), (self.screenheight - 200))) self.modalview.backgroundcolor=uicolor.whitecolor() self.modalview.userinteractionenabled=false let mod

java - Spring and Thymeleaf: Sending an object to a controller from a th:each table -

i making table of experience data using th:each attribute thymeleaf , goal have submit button in each row that, when clicked, send experience object controller corresponds row clicked submit button in. i have no idea whats wrong , can't seem find online problem. here section of webpage code: <div th:unless="${#lists.isempty(borrower.experiences)}"> <h2>list of experiences</h2> <!-- <form action="#" th:action="@{/initiate-edit}" th:object="${experience}" method="post">--> <table id="your-table-id"> <thead> <tr> <td>edit buttons</td> <th>date planted</th> <th>rating</th> <th>category</th> <th>dept</th> <th>resolution</th> <th>source</

design patterns - Javascript Singleton Factory -

so i've got singleton "class" works pretty well: function base_singleton () { if ( base_singleton.prototype._singletoninstance ) return base_singleton.prototype._singletoninstance; else return base_singleton.prototype._singletoninstance = this; } this works great. make multiple instances if want, , reflect changes of each other: var sing1 = new base_singleton(); var sing2 = new base_singleton(); sing1.foo = "bar"; sing2.foo === "bar"; // true so want able create multiple singleton interfaces, own info. i'm open way of accomplishing this. 2 methods came mind either extending or making factory. when try extending, new object gets prototype of base_singleton , it's not extending it's creating instance. i figure best way via factory can create new object each time: var singleton_factory = new function () { // let's assume in web environment var global = global || window; /** * bui

c# - Read XML to dictionary -

i know question have been asked multiple times, have not manage solve problem despite trying several suggestions other similar questions. now ask instead, in hope answer. i have xml file: <?xml version="1.0" encoding="utf-8"?> <webcommands> <webcommand> <fullcommand>@ 05c9fe42-8d89-401d-a9a5-2d82af58e16f test webcommands!</fullcommand> <timestamp>18.06.2015 02:56:22</timestamp> </webcommand> </webcommands> i need fullcommand , timestamp added dictionary dictionary<datetime, string> commands = new dictionary<datetime, string>(); how i: 1. add fullcommand , timestamp dictionary? 2. convert timestamp string proper datetime? add fullcommand , timestamp dictionary? var commands = new dictionary<datetime, string>(); xdocument xdoc = xdocument.load("filename.xml"); foreach (xelement xcommand in

Unexpected Laravel 5 errors using Vagrant -

i'm usign project structure using vagrant + puppet + capistrano + laravel 5 api , working deploying local stage 1 month yesterday can't execute local environment. when vagrant machine doesn't show error , deleted box, instance, re-installed virtualbox , vagrant , still same error , weirdest thing in other computer works fine no issues. the error happens when update/install composer in "generating autoload files" generating autoload files php warning: strpos(): empty needle in /var/www/ubiq/src/vendor/vlucas/phpdotenv/src/dotenv.php on line 51 php stack trace: php 1. {main}() /var/www/ubiq/src/artisan:0 php 2. illuminate\foundation\console\kernel->handle() /var/www/ubiq/src/artisan:36 php 3. illuminate\foundation\console\kernel->bootstrap() /var/www/ubiq/src/vendor/laravel/framework/src/illuminate/foundation/console/kernel.php:92 php 4. illuminate\foundation\application->bootstrapwith() /var/www/ubiq/src/vendor/laravel/framework/src/

Git workflow for 2 separate projects sharing similar code -

i have 2 projects each need similar functionality ( custom wordpress plugin ). 2 substantially different in implementation fundamentally same thing underneath hood. i working on both of these projects concurrently, ( , on own not part of team ). i don't know git enough know there workflow use here don't have develop projects separately, or maybe should developing them separately, don't know. the way imagine would fork first project , have 2 separate repos, fine want able bring in changes project #1 project #2 later ( after more code has been added after fork ) ... , might want to have same thing going on other direction ( p2 p1 ) .... can me make sense of should aiming here. it depends on how 2 projects isolated/co-implemented, can git submodules . it adds complexity of managing third branch/repository, architecturally enforces hard division between , isn't shared between 2 projects having both include third shared git submodule.

java - In an Eclipse Project, how to get simplelogger.properties file automatically included if using SLF4J Simple Logging? -

i have downloaded , unzip slf4j 1.7.12 on pc @ d:/source/programsinstalled/slf4j-1.7.12 folder. i want work simple logging of slf4j concentrating on these 2 files: slf4j-api-1.7.12.jar slf4j-simple-1.7.12.jar in eclipse want have above 2 files treated 1 library can include library in project if need it. so in eclipse created new user library named slf4j_1.7.12_simple , include above 2 files in it. now in project want use simple logging of slf4j, can include user library slf4j_1.7.12_simple . but in such project want include simplelogger.properties file. possible automatically include file in project if project include user library slf4j_1.7.12_simple ? if yes how? assume simplelogger.properties file located in d:/source/programsinstalled/slf4j-1.7.12 folder. thanks

Meteor show update field instead of item if update clicked -

i have simplest meteor project ever, i'm stuck @ basic. have 1 form field, , when enter item goes mongo collection. retrieve , display collection, along buttons delete or edit. want happen click edit, , item becomes text box (prepopulated original value) can change, hit return, , have item updated. i'm stuck @ how pass _id along and/or how convert correct entry field. my .html file: <head> <title>memorial</title> </head> <body> <h1>memorial testing!</h1> <form class="new-task"> <input type="text" name="text" placehoder="type stuff here" /> </form> {{> listing}} </body> <template name="listing"> <ul> {{#each tasks}} {{> crudlist}} {{/each}} </ul> </template> <template name="crudlist"> {{#if editor}} {{#if editid == this._id}} <li

java - Converting a PDF to text using Tesseract OCR -

aim : convert pdf base64 pdf can general pdf or scanned one. i using tesseract ocr converting scanned pdfs text files. since working in java, using terr4j library this. the flow of program have thought follows: get pdf file ---> convert each page image using ghost4j ---> pass each image tess4f ocr ---> convert whole text base64 . i have been able convert pdf file images using following code: package helpers; import java.io.file; import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.ioexception; import java.awt.image; import java.awt.image.renderedimage; import java.util.list; import javax.imageio.imageio; import org.ghost4j.document.documentexception; import org.ghost4j.document.pdfdocument; import org.ghost4j.analyzer.fontanalyzer; import org.ghost4j.renderer.rendererexception; import org.ghost4j.renderer.simplerenderer; import net.sourceforge.tess4j.*; class encoder { public static byte[] createbytearray(file pcurrentfold

Thymeleaf Double Reference to CSS -

in many thymeleaf examples (such a spring boot thymeleaf example , links stylesheets referenced twice in link first reference uses thymeleaf th:ref , second uses standard href : <link rel="stylesheet" th:href="@/css/bootstrap.min.css}" href="../../css/bootstrap.min.css" /> removing href="../../css/bootstrap.min.css" not seem break anything. is there benefit having double reference or go wrong if second reference removed? there no need second href explained in documentation : the th:href tag allowed ( optionally ) have working static href attribute in our template, our template links remained navigable browser when opened directly prototyping purposes. so benefit of having static reference have working template , navigable using browser, best case prototyping. if want remove it, nothing goes wrong.

python for-loop parallelization using multiprocessing.pool -

i have piece of code looks this: def calc_stuff(x,a,b,c): ... return y x = range(n) y = zeros(x.shape) if __name__ == '__main__': p = pool(nprocs) y = p.map(calc_stuff,x,a,b,c) this not work, , searched online, because map function deals iterables rather argument lists. wonder what's simplest method modify code parallelize it, i.e., x array/iterable want parallelize. thank you. one option use itertools.repeat zip (or itertools.izip ) build multiple arguments iterable of tuples , use multiprocessing.pool.starmap call function tuple unpacked arguments: from itertools import repeat if __name__ == '__main__': p = pool(nprocs) y = p.starmap(calc_stuff, zip(x, repeat(a), repeat(b), repeat(c)))

c# - Split a word into an array of unique letters -

how split string array of unique characters using c#? i know code below splits string array, won't pick out unique characters: string s = "robot"; char[] chararray = s.tochararray(); (int = 0; < chararray.length; i++) { console.writeline(chararray[i]); } this done easy linq: char[] chararray = s.tochararray().distinct().toarray()

Find iOS appNames to launch via javascript -

Image
i've searched , found open facebook is: window.location = "fb://"; /* works fine */ instead of: window.location = "facebook://"; /* doesn't work */ the problem is: i need open app "facebook", don't know how find appname url scheme fb:// "facebook"... i've tried lot of name combinations, without success. i glad if give me hint achieve this. as palpatim said, can @ online registry, such this one . otherwise, there no way scheme programatically in javascript. can find hand if open .ipa file, in payload/*appname.app/info.plist . you'll see list of urls this: this picture example respond product:// . be aware opening .ipa file might considered reverse engineering, on own apps.

javascript - translateX to left of viewport -

is there way translatex left side of viewport? need use css animation using translatex rather left. here codepen approximates trying do, using velocity.js plugin. problem want animate translatex top left of viewport, not sure how calculate that.. here relevant javascript setting translatex: .setvelocity(".animate-it", {translatex: '[this need help]' }, {duration: 150}) thanks suggestions! myabe set inital position top left , store in class, , same second state (put in other class)...and then, via javascript, change classes want applied.

javascript - Jquery one click starts and second sends data -

i trying selected item dropdownlist , send data jquery function call function. works in debug put break on url, reclick button invoked , press continue. not work on over click. has experienced and/or know how solve it? view: <div> @using (html.beginform()) { @html.partial("~/views/notifications/notificationsdetails_actions_partial.cshtml", /*id*/model) @html.dropdownlist( "notification", new selectlist(viewbag.notification, "text", "value", new { name = "name" })) <button class="btn btn-default" id="updategames" type="submit" style="background-color: green; color: black;"> update games </button> <span class="glyphicon glyphicon-ok" id="updategamesok" style="display: none"> </span> <span class="glyphi

sql - CONTAINSTABLE issue -

i have set full-text indexing in database along containstable users can search on website against product skus & product names. have set customization on search, strips hyphen (-) out of users search , in database column when grabs values. have run issue on search searching '10-10' results in broken page, error listing : source:.net sqlclient data provider message:timeout expired. timeout period elapsed prior completion of operation or server not responding. stack trace: @ system.data.sqlclient.sqlconnection.onerror(sqlexception exception, boolean breakconnection) @ system.data.sqlclient.tdsparser.throwexceptionandwarning(tdsparserstateobject stateobj) @ system.data.sqlclient.tdsparser.run(runbehavior runbehavior, sqlcommand cmdhandler, sqldatareader datastream, bulkcopysimpleresultset bulkcopyhandler, tdsparserstateobject stateobj) @ system.data.sqlclient.sqldatareader.consumemetadata() @ system.data.sqlclient.sqldatareader.get_metadata() @ system.data.sqlclient.s

java - Dictionary WebService DictService.asmx code doesn't work in Eclipse -

i'm trying compile , run following code in eclipse, doesn't work. goal make request on dictionary web service http://services.aonaware.com/dictservice/dictservice.asmx?wsdl word , definition of word user. please fix it. think plugins missing, because shows errors near import statements. import static com.jayway.restassured.restassured.*; import static com.jayway.restassured.path.xml.xmlpath.*; import com.jayway.restassured.path.xml.element.node; // restassured source: http://grepcode.com/file/repo1.maven.org/maven2/com.jayway.restassured/rest-assured/1.6/com/jayway/restassured/restassured.java#restassured // url: http://services.aonaware.com/dictservice/dictservice.asmx/define?word=string // wsdl: http://services.aonaware.com/dictservice/dictservice.asmx?wsdl public class ratest { public static void main(string[] args) { baseuri = "http://services.aonaware.com"; port = 80; string defcandidate = "fastidious"; string xml = g

php - Write to TXT file with length delimited data -

i'm trying write text file on php, fields need length each one. order number 10 characters long, order name 5 characters, telephone 12 characters long. ex: 12345 1234 123456789123 if try: fwrite('text.txt', '12345', 10); fwrite('text.txt', '1234', 5); fwrite('text.txt', '12346789123', 12); i get: 123451234123456789123 how can tell add spaces specific size need in each field. you use fwrite('text.txt', str_pad('12345', 10, " ")); fwrite('text.txt', str_pad('1234', 5, " ")); fwrite('text.txt', str_pad('12346789123', 12, " "));

how to replace pairwise characters in a string using Python -

suppose have string : x="aaaabbabaabccabbca" and have following information : aaa=1 abb= ignore/remove final output aba=2 abc=3 cab=4 bca= ignore/remove final output so when translate x output y should be: y=1234 i tried: def fun(x): x=x.replace("aaa","1") x=x.replace("aba","2") x=x.replace("abb","") x=x.replace("abc","3") x=x.replace("bca","") x=x.replace("cab","4") print x but giving me wrong answer: 123cca i tried: def fun(x): z=[] in range(0,(len(x)+1)): if i=="aaa": i=i.replace("aaa",1) z.append(i) elif i=="aba": i=i.replace("aba",2) elif i=="abb": i=i.replace("abb","") elif i=="abc": i=i.replace("abc&

python - Getting events while using Qt Designer -

i developing application uses treeview. initially, used qt designer gui , after, compiled ui file python. until fine. want copy , paste file on pressing copy , paste buttons simultaneously. watched , read many tutorials used re implementation of qpushbutton . can't adopt technique because used designer create gui , cant make changes in file. please me figure out how can use qevents of treeview. hope question clear.

ember.js - Moving an ArrayController/View to a Component in Ember 1.13 -

i'm in process of updating ember app use 1.13 , having issue translating particular ember.view , associated ember.arraycontroller ember.component , per deprecation guide . after repurposing code, have following: app/templates/page.hbs {{example-component content=posts}} // "posts" being array of objects app/templates/components/post-list.hbs {{#each content key="@index" |post|}} {{post.title}} {{/each}} in cases, order of items in posts array need change (via ember.sortablemixin ), , these changes need reflected on screen. when this, however, seems though content isn't being binded correctly , doesn't update visually (though order of posts data correct in pagecontroller ). i hope makes sense. appreciated! with of @locks in freenode irc, have answer. issue had key being iterated on in {{#each}} loop. changing key="@identity" ( ember 1.13.2 ) works desired.