Posts

Showing posts from March, 2010

python - What is the practical application of argsort() -

recently came across argsort() , figured out return indexes of sorted sequence.but not clear @ 1 point, if using sort array why not use sort(). in [77]: import numpy np in [79]: arr = np.array([4,5,1,7,3]) in [80]: arr1 = np.sort(arr) in [81]: arr1 out[81]: array([1, 3, 4, 5, 7]) in [84]: arr2 = np.argsort(arr) in [85]: arr2 out[85]: array([2, 4, 0, 1, 3]) what benefits of argsort on normal sort? can use return result i.e indexes of sorted sequence. having idea of application in real world. numpy lets use array of indices index array: >>> import numpy np >>> arr = np.array([4,5,1,7,3]) >>> arr1 = np.sort(arr) >>> arr2 = np.argsort(arr) >>> arr1 = arr[arr2] >>> arr1 = np.sort(arr) >>> arr1 == arr[arr2] array([ true, true, true, true, true], dtype=bool) this can useful implementing decorate-sort-undecorate routine python's native sort function if give key function - example, sort square

How can I restore my Rails 4 binstubs? -

i regenerated binstubs @ point. used spring worked flawlessly , after first time brought rails console, console come instantly. now appears spring no longer running. when type: rails console i get: looks app's ./bin/rails stub generated bundler. in rails 4, app's bin/ directory contains executables versioned other source code, rather stubs generated on demand. here's how upgrade: bundle config --delete bin # turn off bundler's stub generator rake rails:update:bin # use new rails 4 executables git add bin # add bin/ source control may need remove bin/ .gitignore well. when install gem executable want use in app, generate , add source control: bundle binstubs some-gem-name git add bin/new-executable loading development environment (rails 4.2.3) [1] pry(main)> if type: spring rails console i same message, instead of console coming returned command line. how can command working way in new rails app?

php - Can I assign values to a checkbox for checked and unchecked states? -

i have single checkbox in form want assign values both checked , unchecked states. values saved in mysql database. php retrieve values. <?php // value = 10.00 // should checked value (initial state) function getdel1() { global $con; $get_del1 = "select * delivery"; $run_del1 = mysqli_query($con, $get_del1); while($row_del1=mysqli_fetch_array($run_del1)){ $leeds = $row_del1['delivery_leeds']; echo "$leeds"; } } ?> <?php // value = 20.00 // should unchecked value (user interaction) function getdel2() { global $con; $get_del2 = "select * delivery"; $run_del2 = mysqli_query($con, $get_del2); while($row_del2=mysqli_fetch_array($run_del2)){ $leeds = $row_del2['delivery_other']; echo "$other"; } } ?> i can display values independently calling either function in div adjacent form checkbox don't know how assign values form checkbox , automatically update div depending on user interaction. suggestions? a te

java - Creating a Calendar using javafx -

i little stumped on how started on project have in front of me. need create calendar on javafx stage current date 2 simple next / prior buttons go between months. so far have created minimum, blank stage appear. public class calendar extends application{ @override public void start(stage primarystage) throws exception { primarystage.settitle("java calendar"); pane base = new pane(); scene scene = new scene(base, 500, 300); primarystage.setscene(scene); primarystage.show(); } public static void main(string[] args){ application.launch(args); } } i had noticed under java documentation there calendar class under java.util, documentation rather confusing me on how implement it. want ask, best way approach this? able show me through basics of how or calendar class works? or best off using grid pane, , switch between scene shown on stage when click next or prior button? thank time.

user interface - How to create a search box with 'magnifying glass' image and some text within it -

Image
i want create search box in python 3. aware of entry widget , buttons, want more elegant this . possible create closer 1 in image? if yes, kindly throw light on topic. tia you can using ttk if create new element using image search icon embed text widget using following code. in case add theme provided 'pin' icon element replaced. demo looks original entry on top , new style below: the vsapi element engine available on windows using image element engine define custom element work on tk platforms. import tkinter tk import tkinter.ttk ttk class searchentry(ttk.widget): """ customized version of ttk entry widget element included in text field. custom elements can created using either vsapi engine obtain system theme provided elements (like pin used here) or using "image" element engine create element using tk images. note: class needs registered tk interpreter before gets used calling "register" sta

html - Mobile Contact Form -

i'm struggling bit contact form on site: http://www.sandhtestsite.kaylynnehatch.com/contact-us.html i'm trying work mobile (the rest of site scales down using @mobile screen tags in css). the form stacked fields don't need float or anything, have container , textarea shrink down better fit mobile screens. i've tried using @mobile screen #contactus elements in css doesn't seem work. suggestions? there several issues dealing with. let's step through them 1 one: the contact form loaded iframe , complicates things unnecessarily. the textarea has cols="50" set, extending width off side of mobile screen. fieldset set width of 320px , in addition rule: padding: 20px . following css , fieldset 360px wide. #contactus fieldset { width: 320px; padding: 20px; /* width (320px + (20px*2)) == 360px */ } in addition, may find developer tools such firebug or chrome / safari developer tools indispensable times this. these,

php - Explode every line from text file -

i facing serious problem on days. trying explode each line something.txt file , make array. array structure not want. code given below ( $i=0; $i<count($_files['data']['name']['question']['uploadfiles']); $i++) { foreach(file($_files['data']['name']['question']['uploadfiles'][$i]) $line) { $linedata[] = explode("\n",$line); } } some of file lose proper array structure. like array ( [0] => array ( [1] => a. hemophilia b. hemophilia b [2] => c. von willebrand disease d. idiopathic thrombocytopenic purpura ) ) but want array structure this: array ( [0] => array ( [1] => a. hemophilia [2] => b. hemophilia b [3] => c. von willebrand disease [4] => d. idiopathic thrombocytopenic purpura

javascript - How to convert object to array -

i have json data having property attributes.data . when console.log(attributes.data) value result {"uid" : 1} want convert array. i.e {"uid" : 1} , on want convert form data uid:1 . how in javascripts. if (attributes.type == "post") { xmlhttp.open(attributes.type, attributes.url, true); xmlhttp.setrequestheader('x-requested-with', 'xmlhttprequest'); xmlhttp.setrequestheader("content-type", "application/x-www-form-urlencoded; charset=utf-8"); attributes.data = json.stringify(attributes.data); xmlhttp.send(attributes.data); } while debug in chrome network tab have form data {"uid" :1} want uid: 1 how convert that if need have array values so: ['uid:1', 'key:value', ...] then work: var attribute = { data: { "uid": 1, "key2": 'value', "key3": 'value' } },

c - Radius of an Ellipse at a given angle with given length and width -

Image
i writing function in c returns radius of ellipse @ given angle given length , width; writing calculation in c: unfortunately platform not support math.h there sin , cos functions built in can use. how write calculation in c , store in int ? i have tried: int theta = 90; int = 164; int b = 144; float aa = (((a^2) * ((sin_lookup(deg_to_trigangle(theta)))^2)) + ((b^2) * ((cos_lookup(deg_to_trigangle(theta)))^2))) / (trig_max_angle^2); float result = (a * b) / (my_sqrt(aa)); int value = (int)result; easy enough int getradius(double a, double b, double theta) { double s = sin(theta), c = cos(theta); return (a * b) / sqrt((a*a)*(s*s)+(b*b)*(c*c)) } though i'm not sure why want return int . you'll loose lot of precision. the ^ operator not way powers. it's bitwise xor. common mistake new (c) programmers make. math.h has function pow() calculating powers, said can't use math.h . these values ra

c++ - Change Doxygen format of function signatures in the generated HTML -

i use doxygen document c++ code. in current project, use following format function signatures: myclass(myclass&& other) however, in generated html documentation, brief description has signature: myclass (myclass &&other) and detailed description has signature: myclass ( myclass && other ) is there way of either preserving original format, or changing way doxygen formats signatures? have not found related issue in customization or configuration pages. edit: updated signatures based on discussion in comments. short answer: no. long (and more correct) answer: yes, if you're willing modify source code. file memberdef.cpp has following (line 1668 in i'm looking @ today): // *** write arguments if (argsstring() && !isobjcmethod()) { if (!isdefine() && !istypedef()) ol.writestring(" "); that last line going add space in brief description. (i've verified removing , recompiling.) as detailed

objective c - duplicate symbols for architecture x86_64 when import LWIMKIT.framwork -

project use swift. , after importing lwimkit.framwork, faced duplicate symbols problem. duplicate symbol _objc_class_$_ddttyloggercolorprofile in: /users/arain/library/developer/xcode/deriveddata/taoji-aldpdybccvcoflbbrtplhgqzroqp/build/intermediates/taoji.build/debug-iphonesimulator/taoji.build/objects-normal/x86_64/ddttylogger.o /users/arain/desktop/arain_pro/develop/taoji/lwimkit.framework/lwimkit(ddttylogger.o) duplicate symbol _objc_metaclass_$_ddttyloggercolorprofile in: /users/arain/library/developer/xcode/deriveddata/taoji-aldpdybccvcoflbbrtplhgqzroqp/build/intermediates/taoji.build/debug-iphonesimulator/taoji.build/objects-normal/x86_64/ddttylogger.o /users/arain/desktop/arain_pro/develop/taoji/lwimkit.framework/lwimkit(ddttylogger.o) ... ld: 123 duplicate symbols architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) if delete -objc in other linker flags, can solved, when compiling, problem shows unrecognized selector

twitter bootstrap - How to get nav-form on same line on mobile view -

i have navbar here looks way want on desktop. http://www.bootply.com/it7srdkvia however, on mobile, don't want search box on different line. want displays on same line. want search box appear right of calcs brand name. how both navbar-brand , navbar-form both on same line in mobile view? you're on right track need position css. *i adjusted dropdown use class navbar-right see docs . see working example. .navbar-custom .formsearch { width: 300px; float: left; padding-top: 8px; left: -65px; } @media (max-width: 767px) { .navbar-custom .formsearch { padding-left: 5px; width: 50%; left: -85px; } } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" /> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap

c# - run Masterpage error HTTP Error 403.14 - Forbidden -

why can have error. take solution microsoft enable diretory browing , default document cant solution. 1 help.sorry english bad. i have error http error 403.14 - forbidden web server configured not list contents of directory. causes: default document not configured requested url, , directory browsing not enabled on server. things can try: if not want enable directory browsing, ensure default document configured , file exists. enable directory browsing. go iis express install directory. run appcmd set config /section:system.webserver/directorybrowse /enabled:true enable directory browsing @ server level. run appcmd set config ["site_name"] /section:system.webserver/directorybrowse /enabled:true enable directory browsing @ site level. verify configuration/system.webserver/directorybrowse@enabled attribute set true in site or application configuration file. detailed error information: module directorylistingmodule notification executereque

c# - How to include complex entity fields in a projected entity framework object? -

i use system.data.entity.dbextensions include() method cause complex entity fields included in query results repositories. however, when project entities new classes, seem lose "concretization" of included complex entity fields. example, wanted return event object repo, , able access complex entity field assessment : public class eventrepository { ... public ilist<event> getevents() { using (var context = new mydatabasecontext()) { return context.events .include(evnt => evnt.actualassessment) .tolist(); } } ... } i can run following code without hitch because of include used above: var repoevents = new eventrepository(); var events = repoevents.getevents(); console.writeline(events[0].actualassessment.assessmentdate.tostring()); but want project event s wrapper object extendedevent info, this: public class eventrepository { ... public ilist<extendedevent> getextendedeve

java - Web Api parameter design style -

i try design simple web api using spring. there 1 parameter array of string, api looks public string test(string[] pars){} or there way, take 1 string parameter , split using separator ";" or ":",the api this: public string test(string par){ string pars = par.split(":"); } i want know pros , cons of each other your first option best many reasons. the important 1 default way html/http send multiple values same parameter, send parameter multiple times. used checkboxes , multi-select options lists in html forms. another reason supported out of box spring webmvc: @controller @requestmapping("/test") public class testcontroller { @requestmapping(method = requestmethod.get) public string test(@requestparam("pars") string[] pars){} } to pass array use url http://yourhost/test?pars=par1&pars=par2&pars=par3 obviously disadvantages of second method suggested not standard

Powershell: Reading in a column from a .CSV file and then adding a specific string to the beginning and exporting again -

i'm attempting write script read in csv generated querying ad user information (that part done) allow me add string beginning of each value of column in csv file , export it. for instance have csv file: "displayname","office" bob,7142 janet,8923 santaclaus,0912 niccage,0823 i want take each entry "office", add string "bug" before , export out. modified csv should like: "displayname","office" bob,bug7142 janet,bug8923 santaclaus,bug0912 niccage,bug0823 at point, i've been attempting read in "office" column , displaying "write-host". idea being if can maybe can create new variable like: $bug = "bug" $newvar = $bug$office which second csv file. extremely new powershell scripting. the attempts i've made far these: attempt #1: $userlist = import-csv c:\users\username\csv.csv $userlist | foreach-object ($_.office) { $userlist } attemp

c# - I want to do dropbox sync in xamarin forms -

i have created app in xamarin pcl. want dropbox sync in ios project. have created app in dropbox , have app key , secret key. i have add following mentioned code in appdelegate.cs file const string dropboxsynckey = "appkey"; const string dropboxsyncsecret = "seckey"; var manager = new dbaccountmanager(dropboxsynckey,dropboxsyncsecret); dbaccountmanager.sharedmanager = manager; var account = manager.linkedaccount; if (account != null) { var filesystem = new dbfilesystem (account); dbfilesystem.sharedfilesystem = filesystem; } now how link user account. how user link app. it looks you're using dropbox sync & datastore xamarin component . instructions there, should call in ui event handler, i.e., when user indicates they're ready link dropbox: dbaccountmanager.sharedmanager.linkfromcontroller (mycontroller) there other setup instructions there well. however, component based on deprecated sync , datastores sdk, per

Unexpected behavior from simple shell in C Debian Linux -

the following code: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #define max_line 80 /* max command length */ int main(void) { char fullcmd[max_line-1]; const char *exit_cmd = "exit"; /* command exit shell */ int should_run = 1; /* flag determine when exit*/ while (should_run) { printf("daw.0>"); fflush(stdout); scanf("%s", fullcmd); if (strcmp(fullcmd, exit_cmd) == 0) { should_run = 0; } } return 0; } results in prompt (daw.0>) printing out repeatedly (the number of words - 1 times). example, i type in "hello there everyone, how you?", following output seen: daw.0>hello there everyone, how you? daw.0> daw.0> daw.0> daw.0> daw.0> daw.0> i don't understand why. have lot more need create shell assignment, can't simplest variation work reliably. using debian distribution of

Can not use class org.json.XML on Android Studio -

i want parse xml string json, search , know can use library java-json this. added dependencies build.gradle apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion "23.0.1" defaultconfig { applicationid "com.hnib.docbaoonline" minsdkversion 15 targetsdkversion 23 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) testcompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.0.1' compile 'com.android.support:design:23.0.1' } what did : jsonobject jsonobj = null; try { jsonobj = xml.tojsonobject(samplexml); } catch (jsonexception e) {

php - how show notification information -

how show notification "npm kosong" if have 3 condition on model. , how make on controller show notification. case 1: if condition cek_npm empty = notif "npm empty. check again!" case 2: if condition cek_npm not empty = notif "npm success absent" case 3: if condition npm_mhs , kode_absensi not empty = notif "npm have been absent" , sorry english bad. my model public function cek_npm($arr){ $arr['npm_mhs'] = $this->input->post('npm_mhs'); $datenow=date("y-m-d"); date_default_timezone_set('asia/jakarta'); //$now = date("h:i:s"); $jam_masuk_absensi=""; $query=$this->db->query("select npm_mhs tbl_mahasiswa npm_mhs= '" . $arr['npm_mhs'] . "'"); if($query->num_rows()==0){ $this->session->set_flashdata('info', 'npm tidak ditemukkan '); //return $query->num_row

mysql - phpMyAdmin not showing all rows - wrong number of total records shown -

i'm showing rows (825) in phpmyadmin v4.3.2 mysql innodb table sorted default autoincrement primary key. when sorted ascending, go last page stops @ id = 1150 when should id = 1337. last 200 or records not display. when sorted descending, records correctly start @ last record. oddly, increasing number of rows per page give more of missing rows , if set 250 rows per page, there. any ideas why result set truncated? seems if phpmyadmin miscalculating number of pages. update upgraded latest version 4.5.0.2 , problem persists. update2 query executed when entering table select * gems result: showing rows 0 - 24 (825 total, query took 0.0000 seconds.) when query select count(*) gems result returns 997. problem in estimated number of records phpmyadmin thinks there. i found had following setting in phpmyadmin config file pasted know previous performance fix made. $cfg['maxexactcount'] = 0 this disabled correcting innodb estimates. commented out line,

ios - Xcode 7 Constraint Suggestion is buggy -

Image
i made simple screen in xcode 7 containing single uiimageview . set constraints (as shown in screenshot). xcode still suggesting change uiimageview's leading , trailing constraints. not sure doing wrong here because kind of error did not happened in xcode 6.4

objective c - Changing backgroundcolor of a view seems hard? -

Image
i want change background color of view within view controller. selecting view , opening attributes inspector isn't showing much. should have option here background. tried coding within (void)viewdidload{} with: self.view.backgroundcolor = [nscolor bluecolor]; isn't working either, no object of nsview. what doing wrong? read coding problem has newer version of xcode. coding issue this questioned , answered in best way change background color nsview here code os x [self.view setwantslayer:yes]; [self.view.layer setbackgroundcolor:[[nscolor whitecolor] cgcolor]];

c# - Create Expression from PropertyInfo -

i'm using api expects expression<func<t, object>> , , uses create mappings between different objects: map(x => x.id).to("id__c"); // expression "x => x.id" how can create necessary expression propertyinfo ? idea being: var properties = typeof(t).getproperties(); foreach (var propinfo in properties) { var exp = // how create expression "x => x.id" ??? map(exp).to(name); } you need expression.property , wrap in lambda. 1 tricky bit need convert result object , too: var parameter = expression.parameter(x); var property = expression.property(parameter, propinfo); var conversion = expression.convert(property, typeof(object)); var lambda = expression.lambda<func<t, object>>(conversion, parameter); map(lambda).to(name);

php - Can't access Opencart backend -

i can't login opencart admin panel because when navigate www.mysite.com/admin redirecting home page. have disabled .htaccess file , php.ini file. can see config file, hosting on subdomain maybe cause of problem, not sure. here config.php <?php // http define('http_server', 'http://inaden.360mustang.com/'); // https define('https_server', 'http://inaden.360mustang.com/'); // dir define('dir_application', '/home/mustang/public_html/inaden/catalog/'); define('dir_system', '/home/mustang/public_html/inaden/system/'); define('dir_language', '/home/mustang/public_html/inaden/catalog/language/'); define('dir_template', '/home/mustang/public_html/inaden/catalog/view/theme/'); define('dir_config', '/home/mustang/public_html/inaden/system/config/'); define('dir_image', '/home/mustang/public_html/inaden/image/

android - How to disable Doze for an app? -

the new doze mode on android 6 disables every useful background activity. have app, regularly woke device (even if no lock screen), kept partial wake lock, did scans , reported internet. not spy app - operation on purpose , known users of app. right android 6 doesn't work anymore, because doze mode prevents final communication servers. i found new setting under "battery", did allow me put app on list of app, did not support "battery optimization". in first tests seemed, making app run again. after additional tests found, app not supporting doze , didn't work anymore in background. isn't setting supposed disable doze particular apps? details doze here http://www.androidpolice.com/2015/06/01/android-m-feature-spotlight-this-is-exactly-how-doze-reduces-battery-drain/ i encountered exact issue app requires accelerometer, gyro, , magnetometer operate in background , when screen off. android 6.0 doze prohibits application using sens

javascript - TypeAhead autocomplete not working -

i new typeahead autocomplete, read docs , started work, but, autocomplete not working what did is $('#homesearchbox').typeahead({ order: "desc", source: { data: window.hotelnamearr }, // source: hotelnamearr, callback: { oninit: function (node) { console.log('typeahead initiated on ' + node.selector); } } }); hotelnamearr array is ["xxxxxxxxx, xxxxx", "yyyyyyy,yyyyyyyyyy", "zzzzzzzz - zzzzz - zzz, mmmmm", "cccccccc,rrrrrrrrrr", "cccccccc, ccccccccc"] is there missing ?, in advance

excel - Copying and pasting nonzero rows and adjacent cells -

Image
i dealing lot of gis metadata importing excel, many rows , columns of blank or 0 values. trying take data this: (left column name, columns right values associated name) and selecting columns have value, end new set of tables showing nonzero rows , corresponding name left: i have tried doing filtering data in table shows nonzero values, copying column , far left column , pasting onto new sheet. easy if have few columns, given amount have painstaking. have filter each column separately because rows in each column may or may not have blanks or zeros depending on column. can lookup function used this, or using vba better? why can't use 2 simple loops (rows, columns)?? suppose data start "a1", count rows , columns , play code. sub tras() dim lastrw integer dim lastcol integer dim resultrow integer resultrow = 20 '1th row result lastrw = range("a1").end(xldown).row lastcol = cells(1, activesheet.columns.count).end(xltoleft).column s

php - Update checkbox and textarea value in mysql db using Jquery -

i have textarea , 3 checkboxs in mysql db default textarea value null , checkboxs values zero(0) . when enter text in textarea i'm updating text value in mysql db gotta stuck in checkbox things can 1 suggest how update checkbox checked value in mysql db say example if checkbox checked/clicked should able update mysql db value '1' if not value '0' https://jsfiddle.net/07wmpjqf/1/ db structure id text abc xyz lmn 1 null 0 0 0 thanks! html <div> <textarea class="lb_text" rows="6" cols="50" placeholder="add text here..."></textarea> </div> <div> <label> <input type='checkbox'>abc </label> </div> <div> <label> <input type='checkbox'>xyz </label> </div> <div> <label> <input type='checkbox'>lmn </label> </div&

excel vba - how to view dynamic text in textbox using a command button -

this question regarding excel vba. i cant find logic problem. here want do. i have textbox , command button created in form of excel vba. in worksheet 2 b3 b35 have names written. once click command button textbox text sud go b3 b4 , likewise rest. also range dynamic, names can added or deleted. once empty cell detected should show msgbox list complete. help on appreciable thanks

scanf - Pass a variable directly into a function in C? -

as example assume have function double calculate(double input); takes input , adds 5.0 it, returns value. say wanted take user input . okay create variable use scanf , call double temp . scanf("%lf", &temp); , use function calculate(temp) . is there way pass input directly function calculate without having setup variable in middle? it isn't possible scanf() because function designed parse input in format choose, have assign multiple input values in 1 call. note wouldn't change compiled code anyway because, whether create variable or not, real machine has store value somewhere passing function. if care instead shape of c code, can of course provide own input function does return input, e.g. double getdoubleinput(void) { double in; /* add sanity checks , whatever, following stub ... */ scanf("%lf", &in); return in; } and use instead. compiler inline if appropriate, generated code should stay same.

json - Communication between WCF (ServiceHost) and HTML (JQuery) -

i want program simple "hello world" example communication between wcf service , html page. to program wcf server use code below: namespace consolehelloworldserviceclient { class program { static void main(string[] args) { var adrs = new uri[1]; adrs[0] = new uri("http://localhost:6464"); using (servicehost host = new servicehost(typeof(helloworld.helloworldservice ),adrs)) { host.open(); console.writeline("server open"); console.writeline("press enter close server"); console.readline(); } } } } hello world interface namespace helloworld { [servicecontract] public interface ihelloworldservice { [operationcontract] string sayhello(); } } hello world class namespace helloworld { [datacont

flash - sony flashtool installation Error -

i facing error in installing sony flashtool. able solve on own. here log. what error...? asking u, id......! step -1,install emma software (don't finish it) step -2 before finishing emma software installing folder open (program file, sony, emma step -3 open extract file on emma software copy (custamization. ini.) paste emma installing folder final step.... after finish button click

jquery - javascript code with ajax loading -

i try add css class js element. i'm trying add css class html element via javascript. (function ($) { "use strict"; $(document).ready(function () { $('.delete').addclass('icon-trash'); }); })(jquery.noconflict()); but when element loaded ajax need refresh page see it. how can fix ? you have not used ajax in this, have used jquery.read ajax call , use it. if want go same code of yours try call function onload like <body onload="myfunction()">

google cloud platform - How to do a GQL query (using gcloud-python) -

i have collection of entities of 1 kind . need extract distinct values of 1 property, named p , of these entities. in gql, do: select distinct p kind however in gcloud-python library gql queries aren't implemented yet (see issue-304 ). how should tools available in gcloud-python ? i'm aware of "group-by" workaround, yet performances terrible. gcloud-python doesn't provide way string gql query ( source ), seems can use group_by field in cloud datastore api accomplish same thing. references: https://github.com/googlecloudplatform/gcloud-python/issues/1202 https://cloud.google.com/datastore/docs/apis/v1beta2/datasets/runquery

c# - Printing a PDF Document in ASP MVC Without Showing it First -

i've got code builds pdf document , opens in new tab i'd send straight printer. there lot going on behind code boils down make call controller view <a href="~/controller/getreport/" target="_blank">report</a> the method goes , builds pdf document , returns file. public actionresult getreport() { return file(a byte[] containing content, "application/pdf"); } the resulting pdf displayed in new tab. what i'd rather happens user clicks link , document starts printing or print dialog opens , user clicks ok print. i'm using itextsharp handle of pdf functionality if can used simplify problem. well never got go directly printers did find specifying download file name causes save , open enough requirement.

mysql - Php and Controller: Browser don't find Base Controller -

i'm doing app , i'm using base controller create others ones. when launch controller see error: fatal error: class 'basecontroller' not found in c:\xampp\htdocs\sfitness\api\1-dev\controllers\peoplecontroller.php on line 3 the problem in same folder i've basecontroller.php following send peoplecontroller.php: <?php class peoplecontroller extends basecontroller { public function processgetrequest($request) { $result = null; $result = $this->_model->getallathletes(); return $result; } } ?> following basecontroller.php <?php abstract class basecontroller { public $_model; public function __construct() { $this->_model = new model(); } } ?> how can resolve problem? what's problem? thanks much you should import other file php can see it; in peoplecontroller, following: <?php require_once "basecontroller.php"; class peoplecontroller extends

wpf - Style.Setter with Binding in Universal Windows Applications -

as stated in question below, setters cannot contain bindings in windows rt/phone 8.1 => binding selecteditems in listview viewmodel in windows phone 8.1 has changed in new universal windows applications? still not bindings in values? ok, can't bind datacontext using normal ways, you can it using other (smart) methods: please, @ this. provides "helper" allows bind datacontext setter. http://dlaa.me/blog/post/10089023

Swift Array of dictionaries extension sortInPlace -

using swift 2.1 i'm trying make function sorts array of dictionaries date value key datekey. i want add extension array type, can call using somearray.sortdictionariesbydate(datekey: string, dateformatter: nsdateformatter) extension array element: collectiontype { mutating func sortdictionariesbydate(datekey: string, dateformatter: nsdateformatter) { sortinplace { dateformatter.dateformat = "yyyy-mm-dd't'hh:mm:ss.sssz" if let datestringa: string = ($0 as? [string: anyobject])?[datekey] as? string, let datestringb = ($1 as? [string: anyobject])?[datekey] as? string { if let datea: nsdate = dateformatter.datefromstring(datestringa), dateb: nsdate = dateformatter.datefromstring(datestringb) { return datea.compare(dateb) == .orderedascending } } return false } } } this works fine long dictionaries typed [string: anyobject] , if use on dictionary of type [string: string] doesn't work since it&

Hundreds of MSBuild and ConHost instances spawning and filling up memory when trying to run web Application in Visual Studio 2015 -

to give backstory, used have issue on vs2012 well. randomly (not time), when went run companies web project on ie via vs2012, stall while , fail load. noticed machine struggle anything, , come halt. checking task manager reveal hundreds, if not thousands of msbuild.exe , conhost.exe instance spawned, filling every possible byte of memory (max 8 gigs on machine). had handful of solutions needed built. i never found out real cause, eventual update vs2012 believe curbed issue several months. fast forward today, on machine 16 gigs of ram , running vs2015 14.0.23107. i noticed issue of the infinitely spawning msbuild , conhost back, time filling of 16 gigs of memory. i have searched internet as can, have not found topics similar experiencing. i know 'feature' microsoft, referenced here: msbuild.exe staying open, locking files and other places. but no 1 have seen has problem many msbuilds , conhosts spawn every single byte of memory consumed them, , forced resta

SQL Server- Bulk Export Data without html formatting and line spaces -

i need export database data text file. query looks this: select category1, category2, category3 dbo.tbl1 category1 = 'jp-4' , category2> 4; this works fine data, there html formatting in table entries such <p>,</p>,<br>,</br> etc. ideally need remove when exporting data text file. i've tried simple replace query didn't work. i've got issue line splits , need remove (\n\r). suggestions on how appreciated! the data format this: category1: jp-4 category2: 4 category3:<p>neque porro quisquam est qui dolorem ipsum quia dolor</p> <p>amet, consectetur, adipisci velit</p> category4:<p>neque porro quisquam est qui dolorem ipsum quia dolor</p> i got work with: select replace(replace("category3",'<p>',''),'</p>','') dbo.tbl1 category1= 'jp-4' , category2> 4; but issue i've got 15 columns in total , need several different ta

javascript - Conditionally toggling CSS on $(window).resize() -

i'm trying run following script , doesn't seem working. i'm noob , literally me testing , trying figure out how things work. there's better ways i'm doing here or maybe i'm misunderstanding functions. basically, made link, gave class of .home , toggling visibility . first snippet of code works fine. i decided mess around $(window).resize(); function toggle when resize detected. part isn't working. $(document).ready(function(){ //click toggle $('.toggle').click(function() { if ($('.home').css('visibility') == 'hidden') { $('.home').css('visibility', 'visible'); } else { $('.home').css('visibility', 'hidden'); } }); //showhome var showhome = function () { if ($(window).width() > 799) { $('.home').css('visibility', 'visible'); }; }; $(wind

jdbc - Database connection to Neo4j with Pentaho Spoon -

i want connect neo4j pentaho kettle spoon. downloaded jdbc driver of neo4j this , tried use this guide connect neo4j pentaho kettle spoon. have 2 main problems: downloaded jdbc driver zip file. changed driver extension jar solving problem. when changed extension jar , copy in lib folder , follow this guide faced missing driver error: org.neo4j.jdbc.driver not found how can solve these problems? you can not rename .zip file downloaded github , add lib folder. need compile source code , add .jar file it. or can download compiled file here , add data-integration\lib folder , restart spoon. in table input step select connection type generic database custom connection url jdbc:neo4j://localhost:7474 custom driver class name org.neo4j.jdbc.driver

java - Needing help to place swing components correctly -

Image
in order pass college course, need code software java , swing api. have issues place components want : i want place components in moodpanel: like this which layout should use moodpanel , best way components in second draw ? edit : i'm trying apply solution below, have problems : here public moodpanel(){ super(); this.setbackground(new color(255, 255,0)); this.setlayout(new boxlayout(this,boxlayout.y_axis)); this.choicepanel = new jpanel(); this.choicepanel.setlayout(new gridbaglayout()); this.choicepanel.setbackground(new color(255, 0, 0)); gridbagconstraints c = new gridbagconstraints(); this.statpanel = new jpanel(); this.statpanel.setlayout(new borderlayout()); this.lidtweet= new jlabel(); c.fill = gridbagconstraints.horizontal; c.gridwidth=3; c.gridx=0; c.gridy=0; c.weightx=0.0; c.anchor =gridbagconstraints.first_line_start; this.choicepanel.add(this.lidtweet,c); this.moodgroup = new butt

windows - Passing variables to java process -

i not sure if possible know if possible pass variable java process? my code is: process process = runtime.getruntime().exec("cmd /c *curl command* -o "file.png"); and want like: int x = 0; process process = runtime.getruntime().exec("cmd /c *curl command* -o "filex.png"); x++; this way can have output like: file0.png file1.png file2.png any great. in advance. you're building string. for (int x=0;x<max;x++){ string command = "cmd /c curl command -o \"file" + x + ".png\""; // use it! }

java - Method reference static vs non static -

i've wondered how distinct between static , non static method references same name. in example have class called stringcollector has following 3 methods: stringcollector append(string string) static stringcollector append(stringcollector stringcollector, string string) stringcollector concat(stringcollector stringcollector) if want use stream<string> collect list of strings write that: arrays.aslist("a", "b", "c").stream() .collect(stringcollector::new, stringcollector::append, stringcollector::concat); can see code doesn't compile. think that's because compiler can't deside, method use because each of them match functional. question now: there possible way distinct static method references instance method references? (ps: yes code compiles if rename 1 of 2 methods. each of them.) in case unbound reference instance method append has same arity, argument types , return value reference static method append , no,

Get html source code through Mailchimp API -

i'm trying use mailchimp api download html code used in specific campaign. i looking @ this: http://kb.mailchimp.com/api/resources/campaigns/campaigns-instance which works fine, not see how html source code. because not allowed? now , can access mailchimp v3 api here . if want update html content of specific campaign. use request pattern e.g. unschedule campaign update campaign html content through put method schedule/send campaign i used python script mailchimp access in web application, if want python script ping me...

dart - Polymer 1.0 - how to set icon position programmatically -

using polymer 1.0 , dart, have: paperbutton paperbuttonforget = new paperbutton(); ironicon iconclear = new ironicon(); paperbuttonforget.innerhtml = "forget"; paperbuttonforget.children.add(iconclear); paperbuttonforget.raised=true; the button produced shows "forget x" i have 2 questions: 1) how can make show "x forget" in https://elements.polymer-project.org/elements/paper-button?view=demo:demo/index.html&active=paper-button 2) paperbuttonforget.raised=true; "doesn't work" - maybe need else...? cheers steve this way icon left , button shown raised: import 'dart:html' dom; import 'package:polymer/polymer.dart'; import 'app_element.dart'; import 'package:polymer_elements/paper_button.dart'; import 'package:polymer_elements/iron_icon.dart'; import 'package:polymer_elements/communication_icons.dart'; /// [appelement] main() async { await initpolymer();

photoshop - Return postscript font name quickly -

using cs2, there not quicker way postscript name of font looping on installed fonts , comparing names? function gimmepostscriptfontname(f) { numoffonts = app.fonts.length; (var = 0, numoffonts; < numoffonts; i++) { fnt = app.fonts[i].name; if (f == fnt) { return app.fonts[i].postscriptname; } } } for future reference: var mylayer = app.activedocument.layers[0]; var myfont = app.fonts.getbyname(mylayer.textitem.font).name; alert(myfont);

Gradle task that depends on a failure -

can gradle task depend on failure of task? for example, have auxillary task opens test report in browser. want report appear when task "test" fails, not when tests pass now. task viewtestreport(dependson: 'test') << { def testreport = project.testreportdir.tostring() + "/index.html" "powershell ii \"$testreport\"".execute() } you can try set task's finilizedby property, like: task taskx << { throw new gradleexception('this task fails!'); } task tasky << { if (taskx.state.failure != null) { //here shoud executed if taskx fails println 'taskx failed!' } } taskx.finalizedby tasky you can find explanation gradle's user guide in chapter 14.11 "finalizer tasks" . shortly, due docs: finalizer tasks executed if finalized task fails. so, have check state of finilized task taskstate , if failed, wanted. update: unfortunately,

c++ - Parallel STXXL Vector Initialization -

the following minimal example illustrates behaviour of stxxl when initializing containers in parallel (using openmp): #include <omp.h> #include <stdio.h> #include <stxxl.h> typedef stxxl::vector_generator<float>::result vec_t; int main(int argc, char* argv[]) { const unsigned long num = 8; #pragma omp parallel num_threads(num) { vec_t v; printf("%d\t%p\n", omp_get_thread_num(), &v); } return exit_success; } running either [stxxl-error] file large or [system-error]segmentation fault how can allocate stxxl containers in multiple threads ? the initialization of stxxl containers isn't thread-safe, therefore mutual exclusion thread initializing container needed. using openmp, read follows: #include <omp.h> #include <stdio.h> #include <stxxl.h> typedef stxxl::vector_generator<float>::result vec_t; int main(int argc, char* argv[]) { const u

Is it possible to automate Outlook using Selenium? -

i trying create python script logs in outlook account, opens unread messages, , if has attachments downloads them. however, after login, seems stuck , cannot anything. these activities out of scope of selenium? where run python scripts? you may find rest api helpful. if talking desktop edition here ms states: microsoft not recommend, , not support, automation of microsoft office applications unattended, non-interactive client application or component (including asp, asp.net, dcom, , nt services), because office may exhibit unstable behavior and/or deadlock when office run in environment. if building solution runs in server-side context, should try use components have been made safe unattended execution. or, should try find alternatives allow @ least part of code run client-side. if use office application server-side solution, application lack many of necessary capabilities run successfully. additionally, taking risks stability of overall solution. read more in con

Octave model matrix -

is there simple (non loop) way create model matrix in octave. in r use model.matrix() this. i have array: array = [1;2;3;2] and need (for regression reasons) *(model = [1 0 0 0; 0 1 0 1; 0 0 1 0])* edit on side result model (colum 1 1, column 2 two's etc.: model = [1 0 0 ; 0 1 0 ; 0 0 1 ; 0 1 0] i can loop: model = zeros(4,3); i=1:4 model(i,array(i)) = 1; end but nice in 1 step like: model = model.matrix(array) i can include in formula straight away you need turn values linear indices so: octave:1> array = [1 2 3 2]; octave:2> model = zeros ([numel(array) max(array)]); octave:3> model(sub2ind (size (model), 1:numel(array), array)) = 1 model = 1 0 0 0 1 0 0 0 1 0 1 0 because matrix sparse, possible optimization create sparse matrix instead. octave:4> sp = sparse (1:numel(array), array, 1, numel (array), max (array)) sp = compressed column sparse (rows = 4, cols = 3, nnz = 4 [33%]) (1, 1) -> 1

html - Centering text as block inside a div -

i'm building form used register users. actually i'm having troubles css, i'd center child div inside parent div without success. i've tried different methods , read lot here seems other solutions don't fit me. i don't want use text-align: center; because don't want have centered text, pick text block , center it. has responsive, i've tried % don't how looks on browser. css & hmtl: /* ---===### register page ###===--- */ .registerpage1{ width:100%; height: auto; } .registerpage2{ } .registerpage1 ul{ list-style: none; } div#regmailerror{ display: none; color: red; } div#regplenerror{ display: none; color: red; } div#regpmatcherror{ display: none; color: red; } div#regconderror{ display: none; color: red; } <section class="registerpage1"> <section class="registerpage2"> <form method="post" action="#" onsubmit="" id=