Posts

Showing posts from July, 2014

c# - Entity Framework 6.1.3 and Oracle produces sql with Unicode on NonUnicode column -

Image
i'm using entity framework 6.1.3 oracle manageddataaccess 12.1.022 , oracle.manageddataaccess.entityframework 12.1.022 (nuget packages)(fig 1). project database first , imports model .edmx file running t4 code. fig 1. the database uses varchar2 columns , .edmx file recognizes them nonunicode. (fig 2 & 3) fig 2. fig 3. when running query, oracle error ora-12704: character set mismatch . query: var emp2 = db.employees .where(s => s.first_nm.toupper().startswith(term.toupper()) || s.last_nm.toupper().startswith(term.toupper())) .select(c => new { label = c.first_nm + " " + c.last_nm, value = c.first_nm + " " + c.last_nm }); using .totracestring() can see sql being sent is: select 1 "c1", ((((case when ("extent1"."first_nm" null) n'' /* unicode here null value */ else "extent1...

ios - .realm file automatically backed up by iCloud -

my app rejected because of size of content uploads icloud. file in app's documents folder default.realm database file. think file icloud uploading. how can prevent icloud upload database icloud? thanks. according app backup best practices section of ios app programming guide , <application_data>/library/caches or <application_data>/tmp not backup icloud. generally, can use <application_data>/library/caches directory save data won't backup icloud. to change file path of realm, can pass path parameter when creating realm instance, below: let realmpath = nssearchpathfordirectoriesindomains(.cachesdirectory, .userdomainmask, true)[0] as! string let realm = realm(path: realmpath.stringbyappendingpathcomponent("data.realm")) otherwise, can use nsurlisexcludedfrombackupkey file system property exclude files , directories backups (see technical q&a qa1719 ). if want use default path, there way exclude realm file backups. let ...

Laravel 5.1 Date_Format Validator Fails on Y-m-d Format -

i'm starting use request objects validate incoming post data, , i've seen examples of how others using date_format , can't seem dates pass though i'm using format passes when use php's date_parse_from_format: print_r(date_parse_from_format('y-m-d','2015-07-27')); output update : warning in date_parse_from_format, don't understand why reflects format. { "year": 2015, "month": 2, "day": 30, "hour": false, "minute": false, "second": false, "fraction": false, "warning_count": 1, "warnings": { "10": "the parsed date invalid" }, "error_count": 0, "errors": [], "is_localtime": false } validator public function rules() { return [ 'rental_id' => 'required|exists:rentals,id', 'start_at' => 're...

Android Camera 2 FocusArea -

in old camera api had camera.parameters's setfocusarea specify rect camera focus, in new camera2 api can specify focus distance. knows how specify rect camera focus? the desired effect implement focus on touch. found lot of answers here in stack overflow implement focus on touch in new camera api, no 1 lets me specify rect. you can set autofocus metering region in capturerequest control_af_regions key. there corresponding keys auto-exposure , auto-white balance regions well.

javascript - outerWidth() Returns a Different Value when Element is Hidden -

i trying make tweaks jquery ui multiselect widget . one issue i'm having main control little wide after refresh control. looking @ code, width set using: var width = this.element.outerwidth(); where this.element refers original <select> control, has been hidden jquery ui multiselect widget. playing around this, can see outerwidth() returns 424 when <select> element hidden, , returns 406 when visible. (note width() returns larger value when element hidden.) does know why or how width change depending on whether or not control visible? value returned when control visible appears correct value. edit: i have created jsfiddle demonstrate this. you can't width of display:none; element. you need hide position:absolute; , left:-999999px; . here css need. don't forget put position:relative on div wrapper. jsfiddle : http://jsfiddle.net/7xqk01oa/3/

angularjs - Angular Instagram endpoint embed issue -

i have sample angular app fetches content user through endpoint, without use of calling hashtags. can retrieve photos given hashtag example work, rather entire feed of user.this working content link sample: var endpoint = " https://api.instagram.com/v1/media/popular?client_id=642176ece1e7445e99244cec26f4de1f&callback=json_callback "; i registered new app, have client id , client secret, , i'm trying embed entire user feed page. while looking through https://instagram.com/developer/endpoints/ can't seem find link works client id , client secret. any appreciated. there never going "link" works client secret. client secret used back-end programming language using instagram sdk. if passed client secret through simple url or front-end programming language, wouldn't secret anymore ;). some example sdk's / libraries : node: https://github.com/totemstech/instagram-node python: https://github.com/instagram/python-instagram r...

osx - Setting Background Color of NSTableCellView in Swift -

after searching through , online, i'm struggling figure out concept thought relatively simple. essentially, have table in os x swift app, several columns, , populating data. trying discern how can set background color of each "row" (ideally alternating colors, i'll start 1 color). masterviewcontroller file so; import cocoa class masterviewcontroller: nsviewcontroller { var minions = [minion]() func setupsampleminion() { minions = minion.fetchminiondata() } override func viewdidload() { super.viewdidload() // view setup here. } } // mark: - nstableviewdatasource extension masterviewcontroller: nstableviewdatasource { func numberofrowsintableview(atableview: nstableview) -> int { return self.minions.count } func tableview(tableview: nstableview, viewfortablecolumn tablecolumn: nstablecolumn?, row: int) -> nsview? { // 1 var cellview: nstablecellview = tableview.makeviewwithidentifier(tablecolumn!.identifier, owner: self) as...

r - How to identify the longest range of consecutive years in a list together with both the start and end date? -

say have list of year integers follows: olap = c(1992, 1993, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2011, 2012, 2013, 2014); what least complicated , r-like way of identifying longest range of consecutive years both start date , end date? expect obtain: length: 10, start year: 1997, end year: 2006. i have been searching little around web including site , people seem recommend using rle() in case. approach solve problem follows: olap_diff_rle = rle(diff(olap)); max_diff_run = max(olap_diff_rle$lengths[olap_diff_rle$values==1]); idx = cumsum(olap_diff_rle$lengths)[olap_diff_rle$lengths==max_diff_run] + 1; max_olap_end_year = olap[idx]; max_olap_start_year = olap_end_year - max_diff_run; max_olap = max_diff_run + 1; but appears horribly non-elegant. there must less complicated way of doing this!? want use base r though, no package. have read 1 might use which(diff()!= 1) identify breaks , continue there? i approach diff , rle this with(rle(...

ios - Access Variables of ViewController Before Popping To It -

i have home button triggers code when pressed. need change variable within viewcontroller popping before pop it. there way this? func gohome(){ let switchviewcontroller = self.navigationcontroller?.viewcontrollers[1] as! uiviewcontroller self.navigationcontroller?.poptoviewcontroller(switchviewcontroller, animated: true) } this how thought go no variables of viewcontroller appear in autocomplete window. switchviewcontroller.x = 5 any information on how go and/or why isn't working appreciated. you're setting switchviewcontroller generic uiviewcontroller , has no variable .x . you should set correct class, in case whatever named class has 'x' variable: let switchviewcontroller = self.navigationcontroller?.viewcontrollers[1] as! switchviewcontroller switchviewcontroller.x = 5 in case i've used class name switchviewcontroller , means you'd need .swift class file so: import uikit class switchviewcontroller: uivie...

python - Parsing: How do I strip out Unicode Characters? -

i wrote code grab text in between break elements on webpage http://www.virginiaequestrian.com/main.cfm?action=greenpages&sub=view&id=10478 i think on right track right getting bad values below results [u'2133 craigs store road', u'afton,\r\n\t\tva \xa0\r\n\t\t22920', u'contact person:', u'email address:', u'website:', u'phone: 434-882-3150', u''] i need figure out how strip out unicode result values. can help? r=requests.get('http://www.virginiaequestrian.com/main.cfm?action=greenpages&sub=view&id=10478') soup=beautifulsoup(r.content,'lxml') tbl=soup.findall('table')[2] contact=tbl.findall('p')[0] list=[] br in contact.findall('br'): next = br.nextsibling text=next.strip() list.append(text) print list you can use replace built-in function str type has. text = next.strip().replace("\n", "").replace("\t", ...

python - Checking if an input is in sql alchemy data-type format -

so i'm parsing information excel sheet , running data-type issues. there different fields, dates , strings, etc. problem people idiots , inputting things incorrectly. date field might 'na' or that. trying condition if it's not correct format, replace none. so in psuedo-code if not( expiration_date date.format): expiration_date = none however can't find online can me. there efficient way of doing this? in case wanted code, here go: import datetime expiration_date=datetime.datetime.now() if type(expiration_date) != datetime.datetime: expiration_date = none

javascript - jquery check if standard value is selected before submit in input? -

i have dropdown box created divs, possible check jquery if other "select domain" selected before submit, if not should not submitted. <div class="customselectbox" id="customselectbox_1"> <input type="hidden" name="domainname" value="select domain" class="customselectbox_input"> <div class="customselectbox_text" style="width: 82px;">select domain</div> <div class="customselectbox_array"></div> <div class="customselectbox_values" style="visibility: hidden; width: 122px;"> <div class="customselectbox_valbox scroll-pane" style="overflow: hidden; padding: 0px; width: 122px;"> <div class="jspcontainer" style="width: 122px; height: 68px;"><div class="jsppane" style="padding: 0px; top: 0p...

VS 2015 Use Gulp to Compile Less -

i trying set similar process web essentials offered in old visual studio in newest one. of aren't familiar how worked, process was: file setup: a.less a.css a.min.css a.css.map b.less b.css b.min.css b.css.map so when open a.less , start editing it, automatically check out a.css, a.min.css, , a.css.map well. when save, recompile 3 sub files saving less file. i able replicate writing separate task each file so: gulp.task('checkout', function () { return gulp.src('styles/brands.css') .pipe(tfs()); }); gulp.task('less', ['checkout'], function () { del('styles/brands.css'); return gulp.src('styles/brands.less') .pipe(less()) .pipe(gulp.dest('styles')); }); this uses gulp-tfs-checkout checkout sub file, , less compile. works 100% how expect to. can set watch watch less task , work great. problem is, how exp...

Google Maps style does not apply to the Korea area -

i ran problem google maps styling. i used styled maps wizard customize google maps, realized style not apply areas/tiles near korea. this static in question: http://maps.googleapis.com/maps/api/staticmap?center=33.576299,129.200592&zoom=8&format=png&sensor=false&size=640x640&maptype=roadmap&style=saturation:-50|gamma:2.00 i wonder if bug, or decided behavior? edit: not happen static , happens google maps v3 api, jsfiddle the example on styling maps , different lag/lat. also, happens when zoom level >=7 http://jsfiddle.net/kh4mg93s/ yes , korea not support features offered google map due national law. google map korea can not export map data data centers abroad or including ability dynamically change map image. many south korea maps , services limited domestic uses , google striving make better service. more details here's original answer in korean: original reply google maps korea

android - How to add Action Bar in relativeLayout -

actually want put action bar menu layout given below, no getting how put action bar menu it. can me in fixing problem... <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="16dp" android:paddingright="16dp" android:id="@id/action_bar" > <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="enable pin" android:id="@+id/button" android:layout_marginbottom="140dp" android:layout_alignparentbottom="true" android:layout_alignend="@+id/button2" android:layout_alignstart="@+id/button2" /> <button android:layout_width="wrap_content" android:layout_height=...

c# - Migrating shared project from VS 2013 to 2015 -

we have solution on vs 2013 contains shared code project type ( https://github.com/firstfloorsoftware/mui ). we made minor changes in code , has being part of our solution while. now want open project in vs 2015. although had minor problem shared project seems fixed: https://github.com/firstfloorsoftware/mui/issues/48 i still cannot rid of more 5000 errors on project. can run successfully, have no idea reason many errors. one thing noticed vs 2015 uses standard c# project in solution explorer instead of special icon indicating shared project. how reproduce problem: 1 - download modern ui project github; 2 - open on vs 2015; 3 - make fix mentioned here: https://github.com/firstfloorsoftware/mui/issues/48 4 - reload shared project after fixing project file 5 - notice number of errors on error list. any ideas? igor. it seems issue related missing files during vs 2015 setup due choices did during setup. all did creating new project , choose windows 8 template....

php - Hide Ajax Form After Submit -

i'm using simple ajax form , it's working well: http://blog.teamtreehouse.com/create-ajax-contact-form#comments there 1 little change need do. is there way, using form, hide after message sent? until try using toggle jquery function in submit button, in way form desapear if mail wasn't sent. i know need use listener in html, browser knows when hide form, i'm begginer in js, ajanx, json, etc... thank in advance , i'm sorry english, i'm code , language self learner ;) you should in done function of ajax call : .done(function(response) { // … // clear form. $('#name').val(''); $('#email').val(''); $('#message').val(''); // hide form $('#ajax-contact').hide(); }

python - Object inside a threaded multiprocess is empty -

i have odd situation here. have multiprocess in turn has thread. idea here offload work of appending queue thread (i'm trying cpu usage per python process). anyways, here's odd part. i'm appending results deque, , inside thread attempting send through queue. however, thread not see results appended deque, though object id's same. here code/output: class queueappender(thread): def __init__(self, queue=none, read_deque=none, *args, **kwargs): super(queueappender, self).__init__(*args, **kwargs) self.queue = queue self.contents = read_deque def run(self): while true: print 'queue', id(self.contents), len(self.contents) if self.contents: results = self.contents.popleft() if results none: return self.queue.put(results) else: time.sleep(0.01) class worker(process): def __init__(self, queue=none,...

Python dependency issue -

i've scripts setup in following way - a.py (newly added script) from b import b import c class a(b): def process(self): super().method() c.method1() c.method2() b.py (existing script in prod) import c class b(exception): def method(self): c.method1() c.method2() c.py (existing script in prod) def method1()... def method2()... the dir's hold b.py & c.py in path in prod host. when invoke a.py scheduler, 'module' object has no attribute method() error. method1() & method2() in b.py don't executed. a.py in same dir b.py, i'm assuming nothing need updated in path. i searched here in , found circular dependency issue, few of solutions suggested didn't work in case. any suggestions on how can fix issue? best way resolve these issues if create more scripts in same dir existing ones. what expect super() return? it's meant called within method of class, not directly within module. i...

Can You Get A Users Local LAN IP Address Via JavaScript? -

i know initial reaction question "no" , "it can't done" , "you shouldn't need it, doing wrong". i'm trying users lan ip address, , display on web page. why? because that's page i'm working on about, showing information possible you, visitor: http://www.whatsmyip.org/more-info-about-you/ so i'm not doing ip, other showing user informational purposes. used using small java applet. worked pretty well. these days, browser make hit agree , trust many times, run minor java applet, i'd rather not run 1 @ all. so while got rid of feature, i'd if possible. i, computer consultant, use time time. it's faster go website see ip range network running on, go system preferences, networking, , whatever interface active. so i'm wondering, hoping, if there's way in javascript alone? maybe new object can access, similar way javascript can ask browser geographic location on earth is. maybe theres similar client networking i...

Support for .aspx in SonarQube -

in 2013 question asked. there hints resharper results viewed within sonarqube in future version. have checked pages c#, vb.net , have not found plugin @ time allows adding .aspx files sonarqube project. has there been traction on topic, or general effort support reporting on issues noted resharper on file types .aspx. this use case still not supported. there way in sonarqube import types of files, regardless of whether or not corresponds installed language plugin. but if did that, r# issues not imported on - because check file language matches either c# or vb.net explicitly: https://github.com/sonarcommunity/sonar-resharper/blob/master/src/main/java/org/sonar/plugins/resharper/resharpersensor.java#l146 i've created following ticket, doubt fixed soon: http://jira.sonarsource.com/browse/sonarrshpr-19

Can I make the Controller endpoint accept different json object (I have the matched class in java side)? -

i have different java class in java side . public class prov{ private string providerid = ""; private string upin = ""; ... //with getter , setter } public class proc{ private string procid = ""; private string description = ""; ... //with getter , setter } @controller public class controller{ @requestmapping(value = "service/reports/prov", method = requestmethod.post) @responsebody public string searchprov(@responsebody prov prov){ return "prov" } @requestmapping(value = "service/reports/proc", method = requestmethod.post) @responsebody public string searchprov(@responsebody proc proc){ return "proc" } } now have 2 endpoints defined in controller , wonder if possible passing different json object same endpoint. i tried using inheritance class c. proc extends c , prov extends c. change controller to @controller public class controller{ @requestmapping(v...

ios - Sharing CKAssets between users with CloudKit? -

i want allow users upload image can share other users. either go in private or public storage, in either case need accessible via url. i'm wondering if possible, first , foremost. additionally, i'm aware can query file shared publicly, developer. wonder if compromise security - whether it'd possible 3rd party pose myself , run query gather data of other users. edit: seems may possible cloudkit web services. isn't native api, instead web call, available production apps before release of ios 9? https://developer.apple.com/library/prerelease/ios/documentation/datamanagement/conceptual/cloutkitwebservicesreference/rereferenceassets/rereferenceassets.html#//apple_ref/doc/uid/tp40015240-ch9-sw1 you can share ckassets other ckrecord whoever want. app signed developer account able access cloudkit container. in theory broken on jailbroken device injecting code app. again, valid every solution choose. if want see sample of how foto can shared someone, have @...

c - Segmentation fault: 11 when returning stuct via function pointer in struct -

i'm trying emulate constructor. i'm attempting having parent struct have function pointer returns pointer child struct. appreciated. #include <stdio.h> #include "stdlib.h" typedef struct child_t { char *name; } child; typedef struct parent_t { child (*newchild)(); } parent; child *newchild() { child *child = malloc(sizeof(child)); child->name = "foo"; return child; } int main() { parent parent; child child = parent.newchild(); } i think mean following #include <stdio.h> #include <stdlib.h> typedef struct child_t { char *name; } child; typedef struct parent_t { child * ( *newchild )( void ); } parent; child * newchild( void ) { child *child = malloc( sizeof( child ) ); child->name = "foo"; return child; } int main( void ) { parent parent = { newchild }; child *child = parent.newchild(); puts( child->name ); free( child ); } the...

Visual Studio 2015 Javascript Outlining way too much -

Image
visual studio 2015 seams outline multiline javascript code. have simple code this: $(document).ready(function () { var x = { test1: 1, test2: 2 }; if (1 == 1) { // test } }); visual studio 2015 outlines when press ctrl+k, ctrl+o : possible turn off outlining inside functions? want outlining @ function level. no cant there excellent web essentials outline regions in javascript! you create region after comment //#region & end //#endregion so forget using keyboard shortcuts , manage manually mouse, bit more work can have 'working' regions of code open , huge chunks closed , allows me swap working , non working regions. edit web essentials has changed lot, don't use anymore. use advanced javascript outlining job nicely. edit vs2017 ok above don't work vs2017 use mads kristensen's javascript regions

c# - windowsauthentication_onauthenticate function is not fired in global.asax -

i migrating application asp.net 2.0 asp.net 4.5 , having problem windowsauthentication_onauthenticate function. not getting fired when application runs? in global.asax, have following function: protected sub windowsauthentication_onauthenticate(byval sender object, byval e windowsauthenticationeventargs) if not (e.identity nothing) andalso e.identity.isauthenticated ..... ..... end if end sub i tried couple of things present in this link (point-10 similar mine still getting error) can 1 please suggest me, how can proceed further on this?

Bash trap exit kill last process -

i have following in bash file: (i kill web server once bash script on under circumstances) python -m simplehttpserver 12345 & trap "kill $!" exit i wondering how safe/widespread this? when $! evaluated (i pretty sure happens @ place of declaration, still need advice)? what wrote safe. because you're using double quotes, $! evaluated immediately. if used single quotes evaluated @ time script exits.

salesforce - Complex SOQL query for parent/child records -

i'm trying figure out efficient way build query. have "category" object , in category object there "parent_category__c" field. category product (and there "product_category__c" junction object links categories products.) product can have multiple levels of parent categories. product -> product_category__c -> category <--| |_______| the way system (which inherited) built causing me start bottom-up. have find product first, find product_category__c, , find categories__c. lowest level child category. efficient way query way root category -- keeping in mind have few thousand times each product. i had thought querying categories , storing them in map reference don't know how many categories client have. large. thanks help. decided go recursive route...

batch file - Some confusion in the call command documentation of the Windows XP command processor -

the reference @ ss64.com mentions call command can call internal command whereas windows xp command reference doesn't mention all. old ms dos command reference doesn't mention it. reason why found syntax confusing : call set x= %x% elegant way of expanding user input environment variable compared using parsing capability of command expanded value of environment variable. why command processor have read input variable twice expand ? if user input entered directly command using works without problem. eg. "%userprofile%\desktop\file.txt" no brainer processor when typed directly when same string input via prompt system lost. when input variable has no spaces or special characters there's no need call it,it can used directly. your confusion comes fact call set x=%x% replacement of set x=!%x%! , not of for feature. purpose expand variable value twice . simple example: set /p "str=enter string: " set /p "start=enter start char: ...

php - preventing duplicate row insertion in mysql while importing csv file -

preventing duplicate row insertion in mysql while importing csv file .i want insert data mysql table via importing csv file. how prevent duplicate row insert? create unique index in column might have dups, then load data infile 'file.csv' ignore table table_name fields terminated ',' enclosed '"' escaped '"' lines terminated '\n';

smtp - Java - VM option to specify network device -

in bit of bind (pun intended). we have websphere application server uses mail package send email via javamail, on smtp. have rhel box, non-root access (can't change that), has 2 network devices, eth0 , eth1. mail package used significant number applications , effort update , change labor intensive. previously, did not have worry this.. i need have mail sent eth1, however, have no means configure this. this, https://www-01.ibm.com/support/knowledgecenter/ssd28v_8.5.5/com.ibm.websphere.nd.doc/ae/trun_multiplenic.html , not help, not control outgoing calls. have tried number of javamail vm options, e.g., mail.smtp.localhost / localaddress (but knew get-go incoming port bindings, tried anyway). unfortunately, have not come across vm option allow me specify network device use via javamail or jvm in general (the latter preferred). my intent minimize level of effort accommodate change in server setup (for have no control of). the obvious answer - setup iptables force traf...

c# - visual studio enterprise - load testing - how to log in to ADFS within coded test -

i have recorded performance test using perf/load test project in visual studio per these instructions microsoft: https://msdn.microsoft.com/en-us/library/dn250793.aspx . turned coded test clicking "generate code". now trying run test, doesn't recognise of code it's written, request6body.formpostparameters.add("authmethod", this.context["$hidden1.authmethod"].tostring()); (in case says there's no context parameter called "$hidden1.authmethod"). i know because adfs screen doesn't return same headers etc. each time, has written code around this, , if so, how's done? thanks! for our tests, developed method allows use simulated/fake login, allows use app without adfs , without redirections. of course, should disabled in production. next time record test, start straight away fake login. we use asp.net mvc can show how works in asp.net mvc. controller action [allowanonymous] public actionresult ...

SDL android NDK managing return button -

i using sdl-2.0.3 along ndk-r10e, i'm attempting make return button switch app background tried use function sdl_minimizewindow() nothing ! bug or miss ? here code : if(event.key.keysym.sym == sdlk_ac_back) { sdl_minimizewindow(window); sdl_log("window minimized !\n"); } everything work fine , log message when button pressed window not minimized that doesn't appear supported on android (there's not corresponding minimizing "window" on android, unless count finishing activity ). the sdl_minimizewindow function looks this: void sdl_minimizewindow(sdl_window * window) { check_window_magic(window, ); if (window->flags & sdl_window_minimized) { return; } sdl_updatefullscreenmode(window, sdl_false); if (_this->minimizewindow) { _this->minimizewindow(_this, window); } } where _this sdl_videodevice * , set point sdl_videodevice appropriate platfo...

sdl - Access violation at SDL_CreateRenderer -

Image
i use vc++ 2010 express , working on project when try use sdl_createrenderer function error: first-chance exception @ 0x6c8037be in oyun projem.exe: 0xc0000005: access violation reading location 0x00000010. unhandled exception @ 0x6c8037be in oyun projem.exe: 0xc0000005: access violation reading location 0x00000010. program '[320] oyun projem.exe: native' has exited code -1073741819 (0xc0000005). at line: renderer = sdl_createrenderer(window, -1, sdl_renderer_accelerated); here code #include "stdafx.h" int main(int argc, char* argv[]) { sdl_init(sdl_init_video); sdl_window *window; sdl_renderer *renderer; window = null; window = sdl_createwindow("my first rpg!", 100, 100, 100, 100, sdl_window_shown); renderer = sdl_createrenderer(window, -1, sdl_renderer_accelerated); return 0; } here see when debugging: sdl_createwindow returns null if there failure . code needs check this. // code: window = sdl_createwindow(...

java - Inserting and reading blob memsql -

i'm trying insert blob in memsql database. this source insert, convert blob : byte[] bytes = rs.getstring(2).getbytes("utf-8"); blob blob = insert.inserttablebinary(bytes); this inserttablebinary function : blob blob = conn.createblob(); blob.setbytes(1, bytes); system.out.println(blob.length()); string sql = "insert binaire(receipt) values(\"" + blob + "\")"; executesql(sql); return blob; at moment blob.lenght equals 1555 when read : string sql2 = "select * binaire"; statement st = conn.createstatement(); resultset rs2 = st.executequery(sql2); while(rs2.next()) { blob blob = rs2.getblob(1); system.out.println(blob.length()); } the length 25. strange thing when data in table got : com.mysql.jdbc.blob@6a8bc5d9 so it's doesn't store thing no ? reference object not blob think. but don't know i'm doing wrong, see lot's of example prepared statement features isn't available in ...

Gradle - Make existing android project a child of other project and run "gradlew tasks" -

part 1. i have existing android project built gradle. settings.gradle looks this: include ':android', ':androidtest', ':androidtestapp' build.gradle looks this: buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' } } task wrapper(type: wrapper) { gradleversion = '2.4' } task customclean(dependson: [':android:clean', ':androidtest:clean', ':androidtestapp:clean']) { } allprojects { repositories { mavencentral() mavenlocal() } } what need create project parent of android project , runs android project tasks. add settings.gradle of new root project include 'android-sdk:android' which need now. , works fine, can run tasks of android project gradlew androidbuild : task androidbuild(dependson: 'android-sdk:android:assemble') << { group unitysdkgroupname } pro...

linux - how to Aggregate files or merge -

can 1 merge defferent files common data (columns)? please =( file1.txt id kg year 3454 1000 2010 3454 1200 2011 3323 1150 2009 2332 1000 2011 3454 1156 201 file2.txt id place 3454 a1 3323 a2 2332 a6 5555 a9 file 1+2 id kg year place 3454 1000 2010 a1 3454 1200 2011 a1 3323 1150 2009 a2 2332 1000 2011 a6 3454 1156 2013 a1 so second file should connected first. can see id 5555 file 2 not using. how in linux or.... if don't care maintaining order of lines, use karakfa's join command. to keep original order of lines, use awk awk ' nr==fnr {place[$1]=$2; next} $1 in place {print $0, place[$1]} ' file2.txt file1.txt | column -t id kg year place 3454 1000 2010 a1 3454 1200 2011 a1 3323 1150 2009 a2 2332 1000 2011 a6 3454 1156 201 a1

qml - Custom Qt widget example in Qt Creator errors -

i'm qt beginner, have 5.2.1 version , trying learn qt/qml book on github. however, 1 of basic examples: #ifndef customwidget_h #define customwidget_h #include <qtwidgets> class customwidget : public qwidget { q_object public: explicit customwidget(qwidget *parent = 0); void paintevent(qpaintevent *event); void mousepressevent(qmouseevent *event); void mousemoveevent(qmouseevent *event); private: qpoint m_lastpos; }; #endif // customwidget_h and here errors get: ln function `_start' undefined reference `main' collect2: ld returned 1 exit status i have no idea of these mean, appreciated. made project qt quick application. these included in .pro file qt += core gui greaterthan(qt_major_version, 4): qt += widgets first should go google , errors, can find them , solution, , solutions here in stackoverflow too. for can , hope helps you: ln function _start' don't know mean, can copy full error...

Android: How to fetch Facebook Page Note using Graph API -

i want fetch note data using facebook graph api, , found 1 available deprecated, there alternative? https://developers.facebook.com/docs/graph-api/reference/v1.0/note there no alternative, removed long time ago v2.0: https://developers.facebook.com/docs/apps/changelog#v2_0

php - Parse ini file with brackets -

i have .ini files contains brackets ( ) php.net recomend parse.ini file parse_ini_file() functio, let's code looks like: $ini = parse_ini_file('files/models.ini'); then error looks like: warning: syntax error, unexpected '(' in files/models.ini on line 4 in \index.php on line 48 this text line 4 00name1=100 08/82-11/90 (443/445) typový sešit [v] [27] problem getting file outsite , can not change it, from multiple sites notice words have special meaning in ini file "null" "true" "no" "yes" not kind of situation. so guys can advise me doing wrong or if impossible there workaround? you can use option ini_scanner_raw : $ini = parse_ini_file('files/models.ini', false, ini_scanner_raw); from documentation : if ini_scanner_raw supplied, option values not parsed. result test: $ php test.php array(1) { ["foo"]=> string(9) "foo (bar)" ["00name1"]...

java - How to use join tables with hibernate -

i having difficulty using hibernate select using join tables represent many many. i have following 3 tables (bold represents links / keys) user {id, username , password} group { id , name, scpid} join table = member {id, groupid , username } so have scenario in dao user , group want available groups , available members respectively. this means need provide mapping unsure how this. far groups user have tried complains duplicate username @manytomany(fetch = fetchtype.lazy, cascade = cascadetype.all) @jointable(name = "member", joincolumns = {@joincolumn(name = "username", nullable = false, updatable = false)}, inversejoincolumns = {@joincolumn(name = "username", nullable = false, updatable = false)}) public set<group> getgroups() { return usergroups; } public void setgroups(set<group> usergroups) { this.usergroups = usergroups; } can me in identifying how solve please? thanks according provided code snippet...

if statement - Excel 2010 if condition occurs in column -

i not sure how call title, think describes it. i want make table in excel 2010 , looks following: table1: no. | name | hours available | leftover hours | 1 | john | 40 |   | 2 | pete | 35 |   | 3 | jane | 24 |   | table2: no. | client | hours needed | who? | 1 | client 1 | 4 | john | 2 | client 2 | 16 | jane | 3 | client 3 | 8 | pete | 4 | client 4 | 9 | john | in column 'leftover hours' in table 1, want formula take place. formula has check according name of it's row, in table 2 if occurs there, , if occurs, take 'hours needed'. take 'hours available' , subtract 'hours needed' , output result in 'leftover hours'. in example; john should have 27 leftover hours, pete should have 27 leftover hours , jane should have 8 leftover hours. i hope try accomplish clear , appreciate if willing me. extra column (e) in table 2, fill down: =sumif($d$2:$d$5,d2,$c$2:$c$5) last column in table 1, fi...

xcode - Retain Core Data in unpublished app when upgrading iOS beta version -

i have app developing in xcode beta uses core data , running on ipad ios beta installed. when upgrade ios beta new version, app not restore itunes along of other apps. after running app in xcode using ipad destination, app has previous user defaults restored, core data lost. is there way app's core data restoration after upgrade? when we're talking unpublished app there's no problem. have download app container (xcode - window - devices), select device, select app, tap on 'settings' button below list , select download container . after update select replace container , give downloaded one. way keep not coredata saved in app folder. btw: may use method "swap" user data between few devices. ofc may via code, quicker such rare situations , won't forget delete code later ;).

c++ - Execute command using Win32 -

i execute shell command update firmware procesor atmega 2560 this: avrdude.exe -c breakout -p ft0 -p m2560 -u flash:w:\"file.cpp.hex\":a i can shellexecute() function: shellexecute(0, l"open", l"cmd.exe", l"/c avrdude.exe -c breakout -p ft0 -p m2560 -u flash:w:\"file.cpp.hex\":a > log.txt", 0, sw_hide); but want redirect output buffer, think should use createprocess() function. tried hasn't worked. createprocess(null, l"cmd /c avrdude.exe -c breakout -p ft0 -p m2560 -u flash:w:\"file.cpp.hex\":a", null, null, 0, 0, null, null, null, null); use createprocess() instead of shellexecute() , , provide own pipes can read process's output. msdn has article on topic: creating child process redirected input , output for example: lpwstr cmdline[] = l"avrdude.exe -c breakout -p ft0 -p m2560 -u flash:w:\"file.cpp.hex\":a"; security_attributes sa = {0}; sa.nlength...

list - C# Poor dictionary performance when adding elements -

i have big chunck of data containing ~1.5 million entries. each entry instance of class this: public class element { public guid id { get; set; } public string name { get; set; } public property p... p1... p2... } i have list of guids (~4 millions) need names based on list of instances of element class. i'm storing element objects in dictionary, takes ~90 seconds populate data. there way improve performance when adding items dictionary? data doesn't have duplicates know dictionary checks duplicates when adding new item. the structure doesn't need dictionary if there's better one. tried put element objects in list performed lot better (~9sec) when adding. when need item guid takes more 10min find 4million elements. tried using list.find() , manually iterating through list. also, if instead of using system.guid convert them string , store string representation on data structures whole both operations of populating dictionary , filling names on o...

distribution - Multivariate K-S test in R -

so can run k-s test assess if have difference in distribution of dtwo datasets, outlined here . so lets take following data set.seed(123) n <- 1000 var1 <- runif(n, min=0, max=0.5) var2 <- runif(n, min=0.3, max=0.7) var3 <- rbinom(n=n, size=1, prob = 0.45) df <- data.frame(var1, var2, var3) we can seperate based on var3 outcome df.1 <- subset(df, var3 == 1) df.2 <- subset(df, var3 == 0) now can run kolmogorov–smirnov test test differences in distributions of each individual variable. ks.test(jitter(df.1$var1), jitter(df.2$var1)) ks.test(jitter(df.1$var2), jitter(df.2$var2)) and not suprisngly, not difference , can assume different dataset have been drawn same distribution. can visualised through: plot(ecdf(df.1$var1), col=2) lines(ecdf(df.2$var1)) plot(ecdf(df.1$var2), col=3) lines(ecdf(df.2$var2), col=4) but want consider if distributions between var3==0 , var3==1 differ when consider both var1 & var2 together. is there r package ru...

ruby - Rails - Controller Object Scope vs Controller Function Scope -

i have seen local variables object variables being used in rails controller actions. example of both given below: # local variable class mycontroller < applicationcontroller def some_action local_variable = model.find(<some-condition>).delete end end # object variable class mycontroller < applicationcontroller def some_action @object_variable = model.find(<some-condition>).delete end end i want know difference between both of them , scenarios both suited used in. rails exports controller's instance variables called view context: class usercontroller < applicationcontroller def new @user = user.new end end # view gets @ variables controller. # views/users/new.html.haml = form_for(@user) rails offers mechanism called locals well: class usercontroller < applicationcontroller def new render :new, locals: { user: user.new } end end # locals lexical variables in view context. # views/users/new.html....

java - Is it possible to use the configuration of an application server from another server? -

this weird situation. run main application in application server(say was) , sub application in server (say jboss). , sub application needs use configuration made in main application server(for example , sub application needs use objectpoolmanager configuration made in jboss). possible? no. can of course write kind of adapter, reads configuration , translates jboss format , sets jboss configuration. however, think cost-benefit-factor such development very bad.

How to avoid subclass without use of final Keyword in Java -

final class abstest {} class btest extends abstest {} how prevent creation of subclass(es) without using final keyword? here few options create private constructor make each method final, people can't override them. avoid accidental calling of methods subclass way. doesn't stop subclassing though. put check constructor class: if (this.getclass() != abc.class) { throw new runtimeexception("subclasses not allowed"); } but final is provided solve such problem must say , so better go with final !!!

r - enter line to an object -

hello in r how write function takes input number @ aline should entered existing object matrix(rnorm(9),ncol=3,nrow=5) x<-c(1,7,8) each vector should entered matrix matrix @ row 3 (so should new co row 3 . other rows pushed old row 3 row 4 then one way of doing can : aa<- matrix(rnorm(9),ncol=3,nrow=5) x<-c(1,7,8) rbind(aa[1:2,],x,aa[3:5,]) a similar solution ot this, actually: r: insert vector row in data.frame

What is the Windows command for using git ls-files to copy modified files? -

on unix machine can run: cp $(git ls-files --modified) ../modified-files to copy modified files directory. i'd on windows command line. (this command doesn't work). my question is: what windows command using git ls-files copy modified files? edit: git version is: git version 1.9.5.msysgit.0 clarification: issue isn't whether git ls-files command works or not - question how pass list of files copy command. this worked out: for /f %i in ('git ls-files --modified') set a=%i | copy %a:/=\% c:\temp

java - How to slide an ImageView from left to right smoothly in Android? -

i need make imageview slide left right of screen smooth animation (i want imageview visible during transition) tried following code: display display = getwindowmanager().getdefaultdisplay(); point size = new point(); display.getsize(size); int width = size.x; camion.animate() .translationx(width) .setduration(2000) .setinterpolator(new linearinterpolator()) .setlistener(new animatorlisteneradapter() { @override public void onanimationend(animator animation) { super.onanimationend(animation); //camion.setvisibility(view.gone); } }); the imageview moves animation laggy , not smooth want to. doing wrong on code? creating kind of tween animation simple. follow steps, step 1 create directory anim inside res directory , put slide.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpo...

casting - net.sourceforge.jtds.jdbc.clobimpl cannot be cast to java.lang.string(jTDS) -

useblobs=false using xapooldatasource. throws exception 'title description while call resultset.getobject()' i don`t know issue is. common connection string jdbc:jtds:sqlserver://servername;databasename=xxx;instance=xxx rule official site jdbc:jtds:<server_type>://<server>[:<port>][/<database>][;<property>=<value>[;...]] my solution solve exception title mentioned jdbc:jtds:sqlserver://servername; uselobs=false; databasename=xxx;instance=xxx please put uselobs=false; first param

r - Subsetting a large list and recombining into a dataframe -

say have list in r has lot of elements. structured example below (symbolx 1999, symbolx 2000, symboly 1999, symboly 2000, etc). trying each symbol put years (rbind) , entire set of symbols put newly combined years 1 dataframe (cbind). right code below seems pretty slow when on list of 2600 elements. suggest more efficient way accomplish this? i made reproducible example below (the actual values not important, random now). symbols <- c("symbolx","symboly") first <- structure(list(`_id` = "123182914914", symbol = "symbolx", year = 1999, monthly = data.frame("col2"=runif(10, -0.03, 0.03))), .names = c("_id", "symbol", "year", "monthly")) second <-structure(list(`_id` = "123182914915", symbol = "symbolx", year = 2000, monthly = data.frame("col2"=runif(10, -0.03, 0.03))), ...