Posts

Showing posts from July, 2010

Bug in a Scroll of DataGrid - WPF? -

Image
i hope can me this: i have datagrid 20 rows , every time check checkbox in 1 of columns, label value increasing 100 each time or decreasing if unchecked. so, once i've checked rows value of label 2000. see below: when reduce height of datagrid vertical scroll appear , when i'm checking checkboxes procedure seem similar can see: but if scroll vertical bar downwards, other checkboxes appear enabled or checked, idea why? in case i've checked first 6 checkboxes , value of label 600, fine, why other ones appear checked ? thanks.. here code i've used: <stackpanel name="spuno" width="auto " lostkeyboardfocus="spuno_lostkeyboardfocus" > <button name="btn_accion" margin="5" width="100" height="30" content="accion" click="btn_accion_click"> </button> <label name="lbl_muestra" width="300" margin="5"/...

java - Platform specific cut paste mnemonics swing. -

i'm developing own text-like jcomponent. isn't subclass of jtextcomponent, because isn't using document model. i'd still support standard mnemonics of cut/copy/paste, know keystrokes depend on platform. ultimately, i'll let user edit keybindings themselves, now, i'd @ least default sensible. is possible lookandfeel somehow? or need detect platform myself , have mapping per platform? i'm using java 8 if makes difference. there no laf property i'm aware of purpose. however might able use information inputmap of laf. following works windows 8: import java.awt.*; import javax.swing.*; public class platformmnemonics { public static void main(string[] args) { keystroke copykeystroke = null; keystroke cutkeystroke = null; keystroke pastekeystroke = null; inputmap im = (inputmap) uimanager.get("textfield.focusinputmap"); (keystroke keystroke: im.keys()) { b...

Android GCM registration / device id for push notification is getting changed everytime -

i used code gcm registration id. ( earlier ) // make sure device has proper dependencies. gcmregistrar.checkdevice(this); // make sure manifest set - comment out line // while developing app, uncomment when it's ready. gcmregistrar.checkmanifest(this); // registerreceiver(mhandlemessagereceiver, new intentfilter( // commonutilities.display_message_action)); // gcm registration id final string regid = gcmregistrar.getregistrationid(this); // check if regid presents if (regid.equals("")) { // registration not present, register gcm gcmregistrar.register(this, commonutilities.sender_id); } else { appsharedpreferences.savedeviceidpreference(ctx, regid); // device registered on gcm if (gcmregistrar.isregisteredonserver(this)) { // skips registration. // ...

usb - Arduino Serial Monitor shows strange ASCII characters -

Image
i connected arduimu v3+ via ftdi-cable mac (os x 10.10) (latest vc ftdi driver installed , loaded). inside arduino-software serial monitor (monitoring /dev/cu.usbserial-aj038nz3) shows lot of weird ascii characters. reason problem? instead of using arduino serial monitor, use os x's ability determine baud rate automatically. whenever, use ftdi cable, monitor input using screen command. in case can grep name of device: ls /dev | grep tty\.[uu]sb | awk '{print "/dev/"$1}' | xargs screen check out man screen bit more background. or use simple version finding name of port in /dev folder using screen <name_of_ftdi>

python - How can I hide sensitive data before commiting to GitHub (or any other Git repo)? -

i'm creating code demonstrate how consume rest service in python, don't want api keys visible people when push changes github. how can hide such information? if you’re using python, might consider using keyring module . allows store secret information in system keychain, , there’s no risk accidentally checked git. here’s simple example storing , retrieving api key, based on docs: >>> import keyring >>> keyring.set_password("my_api_key", "username", "abc1234sekrit") >>> keyring.get_password("my_api_key", "username") 'abc1234sekrit'

Import {} from location is not found in VS Code using TypeScript and Angular 2 -

i trying out new angular 2 forms. import statements follows: import {bootstrap, onchange, ngif, component, directive, view, ancestor} 'angular2/angular2'; import {formdirectives, ngcontrol, validators, ngform} 'angular2/forms'; import {regexpwrapper, print, ispresent} 'angular2/src/facade/lang'; import {reflector} 'angular2/src/reflection/reflection'; import {reflectioncapabilities} 'angular2/src/reflection/reflection_capabilities'; the 'angular2/angular2' resolves fine, none of other " from " locations resolve. error is: cannot find module 'angular2/forms'. all of these components in node_modules directory. if put in full path: import {formdirectives, controldirective, validators, templatedrivenformdirective} 'c:/users/deb/node_modules/angular2/forms'; then works. however, should not need use full path. missing when set tsconfig or there else wrong? problem example application did...

php - Zend Form getValues() doesn't work -

i'm trying create simple form zend, need use form in part, create default form in controller modify occurrence private function. have 2 problems: the form getvalues() doesn't take value of text element. i put render @ end of form action, doesn't render right page. the form consists of text field , sumbit button here code of controller: that customize form private function getsearchform($action = '', $name, $type, $placeholder) { $urlhelper = $this->_helper->gethelper('url'); $this->_searchform = new application_form_admin_search_search(); $this->_searchform->setname($name); $text = $this->_searchform->getelement('ricerca'); $text->setlabel('ricerca '.$type); $text->setname($type); $text->setattrib('placeholder', $placeholder); $this->_searchform->setaction($urlhelper->url(array( 'controller' => 'admin', 'actio...

unix - Bash Scripting - AWK with Delimiter? -

i've got header in text file looks this: first-name:last-name:city:home-phone:cell-phone what need display last-name , cell-phone number of each entry. i'm new bash scripting, , i'm not sure can use this. told awk useful, after looking around, still don't quite understand how use it. specify field separator -f : awk -f":" '{print $2, $5}'

sql - Reuse subquery without using temp table or WITH clause in Oracle database -

in oracle 11g, have table, named item , in each record categorize maingroup , subgroup follows: +-------+---------+----------+ item_id maingroup subgroup +-------+---------+---------+ 1 group1 subgroup1 2 group1 subgroup2 3 group2 subgroup1 4 group2 subgroup2 ... i have write program report number of items in table item . report output similar this: subgroup1 subgroup2 group_total group1 10 5 15 group2 0 1 1 subgroup_total 10 6 16 to that, write sql query data , reformat output using java. sql should make complete report itself, i.e. use java reformat output , not calculation. so, decided output of sql should this: +--------------+-----------+-----+ maingroup subgroup cnt +--------------+-----------+-----+ group1 subgroup1 10 group1 subgroup2 5 group1 gro...

yii2 - Multiple alias in one account -

i never used fortrabbit before , have question it. know can create apps , define document root, lets imagine following: i want go yii2 framework (advanced template) advanced template have "two apps" in (2 folders) backend , frontend. on real server have create 2 alias, eg: admin.myapp.com -> root/backend/www www.myapp.com -> root/frontend/www is possible configure fortrabbit work within same application , share same resources (mysql, cache, etc)? your setup possible @ fortrabbit. put both folders in git repo , push forrabbit. after can route subdomains (www., admin.) subfolders (frontend/www, backend/www). if project requires composer install during deploy process not work our of box, since check composer.json/lock in root of project. however can define custom post-deploy scripts. in these script call composer install in subfolders. cheers oliver (fortrabbit staff)

java - How to convert an int[] array to a List? -

i expected code display true : int[] array = {1, 2}; system.out.println(arrays.aslist(array).contains(1)); the arrays.aslist(array) result in singleton list of int[] . it works expect if change int[] integer[] . don't know if helps though.

indexing - Replacing part of date in R column -

there examples of replacing values in single vector of data frame in r other value. e.g. replace value in data frame based on conditional (`if`) statement in r & replace numbers in data frame column in r? i have slight variation of problem, data frame (athletes) errors in year of dob, , want go through , replace instances year 00yy-mm-dd 19yy-mm-dd i tried athletes$dob[athletes$dob == 00] subset values didn't work name country height weight sex dob gold silver bronze 1 lamusi people's republic of china 170 60 m 0089-06-02 0 0 0 2 g kruger united states of america 193 125 m 1979-02-18 0 0 0 3 jamale aarrass france 187 76 m 1981-11-15 0 0 0 4 abdelhak aatakni morocco na na m 0088-02-09 0 0 0 5 maria abakumova russian federation 178 85 f 1986-01-15 0 0 ...

javascript - Send latitude-longitude argument to Google Maps -

i have following code: function initialize(lat, lng) { window.open("https://maps.google.com/?q=<lat>,<lng>"); } can tell me how send lat/lng arguments google maps in url? edit - right now, values being sent maps "lat" , "lng", not actual values such 5 , 10. can tell me how send actual values in call maps? example html: <a href="#" class="map-btn" data-lat="41.8911684" data-lng="12.507724100000019"> show map </a> javascript: $(function(){ $('.map-btn').click(function(event) { var lat = $(this).data('lat'); var lng = $(this).data('lng'); showmap(lat,lng); }); }); function showmap(lat,lng){ var url = "https://maps.google.com/?q=" + lat + "," + lng; window.open(url); } jsfiddle

wordpress - Cannot get wp_redirect to work -

i'm trying send email using wp_mail , then, if mail sent successfully, redirect user page (or, if not successful, error page). my code shown below. email sent, wp_mail working, cannot redirect work. <?php /* template name: redirect template */ ?> <?php $to = "info@some-domain.com"; $subject = 'this test.'; $message = 'this test of wp_mail function.'; $headers = ''; $sent_message = wp_mail( $to, $subject, $message, $headers); if ($sent_message) { $url_1 = "http://www.some-url.com"; wp_redirect($url_1); exit(); } else { $url_2 = "http://www.some-other_url.com"; wp_redirect($url_2); exit(); } ?> <?php get_header(); ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', 'page' ); ?> <?php endwhile; // end of loop. ?> <?php get_footer(); ?> you need rid of white...

c# - Do we need to create Class file for page of website in Asp.net? -

i newbie , learning asp.net. building web application(admin panel) interact db. earlier, when created web application assignments, wrote code insert/delete etc in code behind of asp pages either using sqldatasource or manually writing code. now, learning use ajax/jquery , json crud operations aspx page , have seen class file being created(youtube video). confused why class file created. what's purpose ? practice create classes aspx pages. i created class files winforms in c#. totally confused.i read msdn did not understand purpose of entity framework in terms of benefits. please me information. the main benefit , motive behind having separate class behind page avail decoupling of html code , c# code. little bit decoupled. example if have 1 guy working on html side , 1 coder doing server side, imagine how both of these guys can work @ same time. 1 coder work on .cs file independently , html coder keep on evolving , feel. entity framework nothing wrapper on databa...

How to find entities with one of several attributes in Datomic -

this seemed use case or clause : '[:find ?e1 :where (or [?e1 :a ?e2] [?e1 :b ?e2] [?e1 :c ?e2]) [?e2 :x "x"]] but fails unable resolve symbol: ?e1 in context . something should work (let [rules '[(orclause ?e1 ?e2) [?e1 :a ?e2] (orclause ?e1 ?e2) [?e1 :b ?e2] (orclause ?e1 ?e2) [?e1 :c ?e2]] dbval (d/db conn)] (d/q '[:find ?e1 :in $ ?e2 % :where (orclause ?e1 ?e2)] dbval "x" rules))

c# - how to convert date time if passing null value in date field -

how store null value , how insert null values in database? im getting error. string not recognized valid datetime. if (taskobj.estimatedtime == null) { taskobj.estimatedtime = convert.todatetime(estimatetimelabel.text); } public datetime estimatedtime { set { estimatedtime = value; } { return estimatedtime; } } you need specify in database can allow null specific column. if have database can run like: alter column `yourcolumn` datetime2() default null this allow use null in database. you need convert datetime in code nullable type. otherwise .net comes out default date 1/1/0001 12:00:00 (not helpful). there 2 ways this. recommend first it's purely down coding style. you can either using ? operator: public datetime? estimatedtime { set { estimatedtime = value; } { return estimatedtime; } } or nullable generic function: public nullable<datetime> estimatedtime { set { estimatedtime = value; } { return estimated...

android - MonkeyRunner unable to use startActivity -

the following androimanifest.xml: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.helloworld" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="21" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /...

strftime - C Programing Filename is in chinese symbols -

i trying modify source code need create filename based on date filename being created chinese symbols. compiling using nmake visual studio , unicode. i not sure whether code issue or compiler problem. code extract: struct tm * timeinfo; struct tm *__cdecl localtime(const time_t *t); tchar buffer[80]; time_t rawtime; rawtime = time(null); time(&rawtime); timeinfo = localtime(&rawtime); strftime(buffer, sizeof(buffer), "%d%m%y%h%m%s", timeinfo); prd->command[i] = '\0'; lptstr t; (t = buffer; *t; t++) { if ((*t != '<') && (*t != '>') && (*t != '\"') && (*t != '|') && (*t != '/') && (*t != '\\') && (*t != ':')) prd->command[i++] = *t; } //lstrcat(prd->command, buffer); = lstrlen(prd->command); well after investigation prompted po...

java - How do I hide or show layout elements when an Android Activity goes out of focus? -

i trying hide elements in layout when android goes out of focus, such when viewed in "view recent applications" display, layout elements not visible. upon selecting application , going focus, these elements visible again. my implementation below attempts show "content" layout when application in focus, , show "overlay" layout when out of focus, via onwindowfocuschanged(). activity_main.xml <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity"> <relativelayout android:id="@+id/content" android:layout_width="match_parent" android:layout_height="match_parent"> <textview android:layout_...

MySQL select from 2 tables without having "shared" key -

searched site , found similar questions, none of solutions worked in case. i have 2 tables - clients , memberships. the structure following: clients client_id other_fields... memberships membership_id client_id other_fields... the field submitted form "membership_id". let's submitted value 5. want use single query select fields memberships , clients clients.client_id=memberships.client_id , memberships.membership_id!=5 (select other memberships except submitted one). need select records of client has membership_id 5 (records of other clients , memberships should not selected) used select memberships.*, clients.* memberships memberships, clients clients memberships.client_id=clients.client_id , memberships.membership_id!=5 query displays memberships of clients. , need have memberships of client has membership_id 5. the problem don't know original client_id, can't include in query try adding following end: and exists(select * members...

ios - How to make a AVPlayerViewController go to fullscreen programmatically? -

i'm trying make avplayerviewcontroller go full screen mode programmatically, coming "embedded" mode, not appear possible published api. is there workaround i'm missing? i'm interested in obtaining same animation 1 when user presses full screen button on bottom right of controls. using mpmovieplayercontroller not viable alternative since might have more 1 video playing @ time. thanks. avplayerviewcontroller subclass of uiviewcontroller, presentable other view controller subclass. able use presentviewcontroller:animated:completion ? self.avplayercontroller.modalpresentationstyle = uimodalpresentationoverfullscreen; [self presentviewcontroller:self.avplayercontroller animated:yes completion:nil]; this shows "done" button in top left-hand corner.

ruby on rails - Add validation in acts_as_commentable gem -

i'm using gem called acts_as_commentable i have added custom column in migration like: recipient_id then generated comment model per documentation: rails g comment now, in comment.rb , have following line: validate :comment, :recipient_id, :presence => true note: comment column added gem itself still, after following documentation, when fire following deliberately: commentable = post.create(:title => ......) comment = commentable.comments.create comment.comment = "some comment" comment.recipient_id = nil comment.save! the comment object seems like: <comment id: 1, comment: "some comment", commentable_id: 1, commentable_type: "post", recipient_id: nil, created_at: "2015-06-13 09:41:23", updated_at: "2015-06-13 09:41:23"> why it's not validating presence of recipient_id ? your calling validate instead of validates . both different. it should be: validates :comment, :recipient_i...

angularjs - How to convert square bracket object keys from URL location into nested object in Javascript? -

with: var obj = { "object[foo][bar][ya]": 100 }; how can create: var obj = { object: { foo: { bar: { ya: 100 }}}}; manual approach split given string bracket, iterate through resultant tokens make nested object: given var obj = { "object[foo][bar][ya]": 100 }; split them get var tokens = object.keys(obj)[0] .split('[') .map(function(s){return s.replace(']','')}); // tokens = [ 'object', 'foo', 'bar', 'ya' ] then make nested object, inside out var result = {}; tokens.reverse().foreach(function(key){ if (object.keys(result).length==0){ result[key] = obj[object.keys(obj)[0]]; // inner-most key-value } else{ var temp = {}; temp[key] = result; result = temp; } }); result {"object":{"foo":{"bar":{"ya":100}}}}

c# - Geolocator.GetGeopositionAsync() return rounded values if regional setting isn't set on "English (United-States)" -

i try use geolocation function windows phone 8.1, , works when emulated windows phone has regional setting on "english (united state)", application targetting french people, , when try regional setting (by default on computer) "french (france)" longitude , lattitude values irrelevant, because rounded. my code: geolocator watcher = new geolocator(); watcher.desiredaccuracy = positionaccuracy.high; geoposition position = await watcher.getgeopositionasync(); double lat = position.coordinate.point.position.latitude; double lon = position.coordinate.point.position.longitude; with regional setting on "english (united state)", lat , lon values "48.12345", when keep default / "french (france)" regional setting, "48.0" (and values incorrects watcher object). i tried many thing (i suspect decimal separator guilty maybe geolocation simulator sent value "48,12345", parsing of these value out of scope, sealed function...

php - Jquery Datatables and Jeditable - Data is not displaying -

Image
i using jquery datatables , jeditable. have correct json response follows: [{"country_id":"18","country":"aruba","country_enabled":"1"},{"country_id":"19","country":"afghanistan","country_enabled":null},{"country_id":"22","country":"angola","country_enabled":"1"},{"country_id":"23","country":"anguilla","country_enabled":null},{"country_id":"24","country":"\u00c5land islands","country_enabled":null},{"country_id":"25","country":"albania","country_enabled":null},{"country_id":"26","country":"andorra","country_enabled":null},{"country_id":"27","country":"united arab emirates",...

qt - Why lock the QMutex at here? -

i'm reading qt's blocking fortune client example . there piece of code below: mutex.lock(); qstring fortune; in >> fortune; emit newfortune(fortune); cond.wait(&mutex); servername = hostname; serverport = port; mutex.unlock(); i'm bit confused why lock mutex @ first line. because both fortune , in local variables. or emit should protected? this code: http://doc.qt.io/qt-5/qtnetwork-blockingfortuneclient-fortunethread-cpp.html . entire project can found @ bottom of page. seems lock placed in right place(i'd still place after in >> fortune; ). why might need lock before emit? emit happens in 1 thread while slot gets executed in different thread. following events might happen: t1 emits signal , gets suspended os. t2 gets time quant , having received signal starts executing slot( showfortune ) if nextfortune == currentfortune true thread's requestnewfortune gets executed in t2 context. req...

php - How to change User Table in Laravel? -

i use laravel 5.0. i have user table in db. i changed table variables in user , config/auth user when try register laravel gives me error: table 'xxxx.crmx_users' doesn't exist (sql: select count(*) aggregate `xxxx` `email` = xxx what wrong? why laravel still looking users table? go app\services\registrar.php file, , in validator() function. public function validator(array $data) { return validator::make($data, [ 'name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|confirmed|min:6', ]); } change 'email' => 'required|email|max:255|unique:your_table_name', i believe solve problem.

USB on board switching tools on Android 4.2.2 -

i have e3131 modem not switch way when connected ppp widget 2 on android 4.2.2. asked in dedicated forum widget http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=6&t=2312 can , told there someting sending low level command usb switch modem wring way. explicitly told "the reliable way see disable (rename) on-board switching tools not interfere mode-switching of ppp widget 2." what supposed do? these on-board switchng tools need rename, referred ? appreciated.

url - How to get query string values in JavaScript containing special characters? -

i have followed answer great post: how can query string values in javascript? however, issue having on occasions, query string values contain special characters, example * + - / etc eg: ?userid=de+8d49b7*8a85a3/222343 the above function not cater these. how can query string values , inc special characters? have tried: function getparameterbyname(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new regexp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results === null ? "" : decodeuricomponent(results[1].replace(/\+/g, " ")); } var prodid = encodeuricomponent(getparameterbyname('prodid')); the solution must work in ie8+ too. this should trick: function getparameterbyname(name,ovr) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new regexp("[\\?&]...

single sign on - How can restrict the use of Issued access token of one machine in another machine -

i using thinktecture idenity server v3 idenity provider. issues me access tokens. using these access tokens web api communication. works perfectly. my question if got issued token , try access web api using access token, he/she got access. verified it, got access. how can restrict access token being used issued machine? you right - there standard called bearer tokens. whoever has token, can use it. that's why paramount use transport protection all network communication. there upcoming specs proof of possession semantics , request signatures. https://tools.ietf.org/wg/oauth/

ms access - Accessing protected mysql names via ASP -

currently, i've been assisting convert site using classic asp, using ms access mysql(mainly bridge until time complete rebuild). current table uses various protected keywords column names(datetime, date, order, etc). i'm trying figure out proper ways few inserts on these columns. current code below: set orsess = server.createobject("adodb.recordset") orsess.addnew orsess.fields("order") = cint(xyz) orsess.fields("sessionid") orsess.update now normally, i'd try replace standard sql insert, there's lots of code around, breaks easily. there away add proper escape character mysql recognize properly?

Strings Became Symbols When They Output in C -

Image
i have problem when output strings in codes. when input 1 string , output it, there no problem @ all. but, when input @ least 2 strings, went fail. strings became symbols, except last one. here screenshot: i've been using fflush(stdin) , fflush(stdout), problem still exist. so, should do? need advice. here complete codes: #include <stdio.h> #include <stdlib.h> void menu(); void entry(); void search(); void printsingle(); void printcomplete(); float totalused(int i); float regularcost(int i); float tax(int i); float discount(int i); float totalpayment(int i); #define nmaks 101 typedef enum {false=0,true=1} boolean; typedef struct {int billnumber,billclass;float lastmeter,currentmeter;char name[];} billdatabase; billdatabase bill[nmaks]; int dataamount=0; int main() { menu(); return 0; } void menu() { int i; repeat: system("cls"); printf("\t\t.: electric billing system :.\n\n"); printf("[1] entries ...

java - Android: Read line from text file ending early of asset -

i'm reading text file on thousands of lines of data in on android. each line want read, split apart, save class , add class arraylist. code currently: try { inputstream = this.getassets().open("assets.txt"); bufferedreader reader = new bufferedreader(new inputstreamreader(is)); string line; while ((line = reader.readline()) != null) { // use line variable string[] assetlinesplit = line.split("\\t"); //create object of assets assetobjectclass assetobjects = new assetobjectclass(); assetobjects.setassetnumber(assetlinesplit[0]); assetobjects.setdeparea(assetlinesplit[2]); assetcompletelist.add(assetobjects); //array list log.i("test", assetobjects.getassetnumber()); } catch (exception e) { log.i("test", string.valueof(e)); } of i've obtained around place. things seem working fine in terms of setting objects, seem 470, , terminates i...

debugging - How to find the first entry point in java code? -

this regarding java debugging. there application inserts our application.i want know first point of entry in code debugging, don't know how other app inserts our app. generic code analysis. how this. please let me know if need more inputs?

sql - Difference in years between two dates -

i have table in postgresql has column datatype timestamp named birthdate , possible write sql statement return difference in years birthdate stored in table , current date? how done? server postgresql this have tried giving me syntax error @ second select select datediff(yy, now(), select birthdate match match_id = '550856d8560a64ed180416d1556f5435f4bb054c68930040') there number of things wrong here. select datediff ^^^^ postgresql doesn't have datediff function. regress-> \df datediff list of functions schema | name | result data type | argument data types | type --------+------+------------------+---------------------+------ (0 rows) i think want - operator, extract function, justify_interval , to_char function. also, write current_timestamp instead of now() , it's standard spelling. also this: (yy, now(), select birthdate ...) ^^^ is syntax error because didn't wrap subquery i...

osx - NSTableView - how to get automatic and manual sorting working together? -

i have nstableview in myviewcontroller , have array controller bound it. want able sort clicking table column headers , should auto-sort. auto-sort set sort descriptors binding of array controller in ib following: bind to: myviewcontroller model key path: customsortdescriptors in myviewcontroller class i've added: var customsortdescriptors:[nssortdescriptor] { let sd = nssortdescriptor(key: "string", ascending: true, selector: "localizedstandardcompare:"); return [sd] } and related table column in ib i've set: sort key: string selector: caseinsensitivecompare: this works ok until click on table column header upon error thrown: error setting value key path customsortdescriptors of object nsautounbinder: 0x60000005e060 - nonretaining proxy myapp.myviewcontroller: 0x6000000e6600 (from bound object nsarraycontroller: 0x6000001c0b40[entity: generateddata, number of selected objects: 0]): [myapp.myviewcontroller 0x6000000e660...

Mysql select data in same row -

i'm confused query. data 1 context in 1 row. don't know how that. here's tables's sample. data (table) io(table) iddata idio readval no idio idcontext 1 io1 12 1 io1 c1 2 io2 12.5 2 io2 c1 3 io3 11 3 io3 c1 4 io4 12.2 1 io4 c2 5 io5 10 2 io5 c2 6 io6 10.9 3 io6 c2 i result idcontext io-1 io-2 io-3 c1 12 12.5 11 c2 12.2 10 10.9 i've tried in loop print in table , works, in query faster. actually, query looks : select idcontext, idinput, readval data left join io on io.idio = data.idio order idcontext, no is possible result in 1 single query? you can conditional aggregation: select idcontext, max(case when no = 1 ...

jquery - Get the closest input name after clicking on a link -

i have repeating code : <div class="input-group"> <input type="text" class="form-control" name="001" value="bla bla bla"> <div class="input-group-btn"> <button data-toggle="dropdown" class="btn btn-primary dropdown-toggle">action <span class="caret"></span></button> <ul class="dropdown-menu pull-right"> <li><a href="#" class="img-preview">preview</a></li> <li><a href="#" class="img-change">change</a></li> <li><a href="#" class="img-delete">delete</a></li> </ul> </div> </div> how clicking on change button, can know input name (i.e. : 001) ? i tried: $('.img-change').closest('input').name(); ...

ios - How to change folder path in DerivedData? -

i have following scenario: whenever build, know products , build artifacts generated in folder like: /users/david/library/developer/xcode/deriveddata/myproject-foobar123 . unfortunately, i'd multiple xctool build different targets, different code, in parallel. is safe assume myproject-foobar123 going output folder each of these builds? if so, how can change though i'm building same project (with different code each time in parallel), able build different folders? the reason want know because try rm -rvf /users/david/library/developer/xcode/deriveddata/myproject-foobar123 xctool clean before start build (but run problem when parallelize build)

java - Which way of setting fields value is better and why? -

this question can stupid, want know, there difference? class a{ // common code private int field; public void setfield(int field){ this.field = field; } //way 1 public a(int field){ this.field = field; } //way 2 public a(int field){ setfield(field); } } way 2 better because gives unified way of setting variable value. brings in risk, because you're calling overrideable method in constructor. right syntax using final keyword: public final void setfield(int field){ this.field = field; } //way 2 public a(int field){ setfield(field); } with final method not overriden. if can not afford have final method, don't call setter in constructor. it's strange override setter. this because may want change setter later: add argument checks , throw illegalargumentexception when required. add counter notify observers (in observable pattern) make synchronized block provide thread-safety ...

Django restrict input in the admin -

i'm wondering how can retrict input of field in admin numbers , max of 10 digits. "max of 10 digits" part confusing. the model field one: id_student = models.positiveintegerfield(primary_key=true) how can make sure in admin gets max of 10 digits? i'm kind of lost in docs , imagining weird ways achieve this, bet there simple way. edit tried adding max_length=10 , doesn't work: id_student = models.positiveintegerfield(primary_key=true, max_length=10) i think max_length=10 should trick you.

Javascript not working in html file -

i have written code basic registration page run on webserver javascript doesn't seem working in html file. form post javascript function find errors seems ignoring javascript code when test it. there problem javascript code or in html code? code shown below. <script type="text/javascript" language="javascript"> function checkpasswordmatch(){ var password = document.getelementbyid("pass1").value; var password2 = document.getelementbyid("pass2").value; if(password != password2){ document.getelementbyid("divcheckpasswordmatch").innerhtml = "passwords not match!";} else{ document.getelementbyid("divcheckpasswordmatch").innerhtml = "passwords match.";} } // $(document).ready(function(){ // $("#pass2").keyup(checkpasswordmatch); // }) function error() { var user = document.getelementbyid("user...

selenium webdriver - Dismiss FIle Upload Dialog while running e2e tests on Protractor -

i testing image upload , preview jasny-bootstrap library, using e2e tests on protractor. for reason, image preview shown if sendkeys path input[type=file] after clicking on select button. now, how dismiss file upload dialog opens on clicking select button? i have tried pressing esc using solutions on answer , , none of them work.

geolocation - How do I enter an "empty" POINT() geometry value into a MySQL field of type POINT? -

i have table point geometry field. enter latitude/longitude points this: insert table( point ) values( point( lon_value, lat_value ); sometimes not have lat/lon values enter. unable enter blank, null, or empty point() ... since point(0,0) location on globe, won't work either. what solution here? i use coordinates of north pole insert table( point ) values( point(0.0000,90.0000); if actual coordinates of pole may issue change lon value 0.0000.

logging - iOS Swift - How to save Console Outputs as text files (i.e. println(), NSLog() ) -

i'm trying set simple logger application, , figured i'd more convenient if can nslog() onto text file. there simple method this? you use asl, direct counterpart of syslog write directly text file. some example code useful link documentation

java - Strange text output of e.getSource() on MouseEvent e -

i want able print mouseevent e, have seen people using getsource() method this, mine doesn't give exact output want. in other code people print e.getsource() , gives direct path image. when print e.getsource(): javax.swing.jlabel[,224,7,23x20,alignmentx=0.0,alignmenty=0.0,border=,flags=8388608,maximumsize=,minimumsize=,preferredsize=,defaulticon=file:/c:/users/sam/workspace/rs%20calculator/bin/hitpoints_icon.png,disabledicon=,horizontalalignment=c enter,horizontaltextposition=trailing,icontextgap=4,labelfor=,text=,verticalalignment=center,verticaltextposition=center] this output includes image path want access - lots of other random information. how can print image path? ( /c:/users/sam/workspace/rs%20calculator/bin/hitpoints_icon.png ) for(jlabel j : jlabelarray){ j = new jlabel(imageicons[n]); j.addmouselistener(new mouseadapter(){ @override public void mouseclicked(mouseevent e){ setsize(650,400);...

wpf - Best way to "group" items "virtually"? -

Image
i'm working on custom items based wpf control. "normal" layout, think vertical stackpanel, xaml like: <mycontrol> <item1 /> <item2 /> <item3 /> </mycontrol> in case, simple, 3 item containers created , good. control like: [item1] [item2] [item3] use case #2 is, need support horizontal "grouping"... ideally xaml like: <mycontrol> <item1 /> <stackpanel orientation=horizontal> <item2a /> <item2b /> <item2c /> </stackpanel> <item3 /> </mycontrol> and in case, render as: [item1] [item2a] [item2b] [item2c] [item3] so, i'm going 5 item containers being generated. i've worked out custom layout panel , part works. the issue is, if use stackpanel, i'll 3 item containers makes sense, duh, breaks keyboard interface of control. hacky intercept keyboard , mouse stuff , "re-route" in case, seems hacky , difficult work in generic way. ...

c# - Can PCL libraries run with ASP.NET MVC? -

Image
i wish write library can run on number of targets such wpf, windows phone/mobile, mono, , asp.net. keep searching information on seems pcl's not supported in asp.net? even vs indicates pcl can't used asp.net: so should able write pcl runs on platforms? use pcl apart asp.net, , create normal class library asp.net , copy+paste code? the short answer yes, long pcl profile supports the same .net framework version mvc application targeting, fine. when create portable class library, can choose combination of platforms want code run on. compatibility choices make when creating portable class library translated "profile” identifier, describes platforms library supports. what confused you, fact asp.net not mentioned in list of supported software frameworks (platforms). reason asp.net not software framework, application framework (higher level). means whatever application frameworks target software framework pcl supports, application frameworks work. be s...

google chrome - Wrong action with switch tab shortcut using right ctrl button -

i want switch tabs ctrl+page up/down shortcuts on chrome (using latest version). works correctly when use left ctrl button, right ctrl button, works on days. when doesn't, becomes page up/down instead of correctly being next/previous tab. browse tabs same few sites, don't think it's due websites. i'm not sure causes this. supposed happening? how can make shortcut work when using right ctrl? edit: found it's "ctrl+" shortcuts , not next/previous tab. also, changed keyboard recently, problem has existed since old keyboard i've used 4 or more years, on @ least 2 different computers, , chrome browser use don't know if problem still exist if switch browsers. your right ctrl button not working (hardware problem). maybe it's damaged or somewhat. some pages maybe not alove shortcut's. i'm saying because found on pages, , shortcut's doesn't work on them. i don't see other posible solutions that.

php - Array structure to specify Fedex One Rate using Fedex API RateService -

i've got working request rates shipment using standard fedex rates, want use special fedex 1 rate option can flat rate quotes. unfortunately, code example doesn't show how specify rate request should use fedex 1 rate , i've been unable mentally parse through xml vomit wsdl. i've tried several different array structures pass (what assume) right variables, nothing works. i generated 2 html versions of wsdl using 3rd party generators (neither incredibly helpful, maybe can read them better i). the first includes wsdl directly data types linked definitions: http://inadaydevelopment.com/stackoverflow/fedex/rateservice_v16.html the second more basic, provides hierarchy in more linear fashion valid values @ each level: http://inadaydevelopment.com/stackoverflow/fedex/rateservice_v16_other.html as far can tell, there 2 ways/places can declare want rate quote use 1 rate: 1) $request['variableoptions'] = 'fedex_one_rate'; and 2) $request['re...