Posts

Showing posts from January, 2012

file path shortener c# -

so using streamreader class, , in spot address goes have @"s:\temporary shared space\project\boyscout3\data\full_pack.txt" colleague believes instead of typing out super long filename there short way of getting done. colleague believes can put in @"full_pack.txt*" , file names in computer has name. colleague crazy or actual thing? my colleague believes instead of typing out super long filename there short way of getting done. it depends on context executing program in. can use relative path make string shorter (and more flexible). my colleague believes can put in @"full_pack.txt*" , file names in computer has name. i don't know why added * unless using search method need remove character. "full_pack.txt" grab full_pack.txt current directory, wherever is.

java - SimpleDateFormat and TimeZone format -

i trying make simpledateformat class need without success. here date format need: fri 29 may 2015 10:22:30 gmt-0400 (eastern daylight time) here closest format definition able come with: simpledateformat("eee dd mm yyyy hh:mm:ss z (zzzz)", locale.english) this output: fri 29 may 2015 10:22:30 -0400 (eastern daylight time) is there formatting can need or have no other choice manipulating string insert missing gmt tag? you can add literal gmt surrounded quotes: new simpledateformat("eee dd mm yyyy hh:mm:ss 'gmt'z (zzzz)", locale.english);

c# - xml file not being compiled by XNA -

i'm making game using xna 4.0/visual studio 2013. want load content using xml files, , i'm testing simple xml called terminator.xml. (it's serialized in project class called "movie", 1 property called "name"). i've added xml file content project , set "build action" compile , "copy output directory" copy always. however, keep getting a: file not found ...error. looks xml file never being compiled , transferred debug folder, though should be. here relevant code. it's interesting note spritefont loads, not xml file. font = content.load<spritefont>(@"font"); movie = xnaserializer.deserialize<movie>(@"terminator"); here's error text: could not find file 'c:\users\h119650\documents\visual studio 2013\projects\elysium\elysium\elysium\bin\x86\debug\terminator' also, supposed try put compiled file elysium instead elysiumcontent? seems bit suspec...

fortran - Using 2 of the same type of subroutines with ABAQUS -

in abaqus model need use 2 user defined loads (i.e. 2 x vdload, although question applicable other subroutines). each vdload act on different set of nodes on different part (one line load , 1 pressure load). creating these via cae straightforward, how code/run subroutines ensure each 1 acting on correct part? challenge both parts naturally have similar node numbers you can apply different properties in input file different sections of node sets.

javascript - Preloading SVG images -

i have hundred of simple svg images, stored in 5 different image folders. currently, when needed displayed, retrieved right then. this, part, works, cause flickering, eliminate. there way preload these images prior when needed, cached? i've seen solutions on here, deal small number of images. there preferred way of doing high volume preload? thanks! if have urls of images can start cache them possible in js object using url, , later fetch them there when need them. in page may have list of svg images stored in somewhere, @ end need js array of urls string. here's quick example: // assuming you've gotten urls somewhere , put them in js array var urls = ['url_image_1.svg', 'url_image_2.svg', ... ]; var svgcache = {}; function loaded(){ // increment counter if there still images pending... if(counter++ >= total){ // function called when loaded // e.g. can set flag "i've got images now" alldone(); } ...

intellij idea - Possible to change the colour of the indentation guide lines per indentation level? -

Image
i can change indentation guide line colour shown in image (the green lines): i'd have colour different per indentation level, code inspection , reading. similar poor edit. alternatively if per scope that'd better, i.e. 2 loops @ same indenation level have different colour indentation lines. anybody know if possible in intellij/android studio? thanks! the color of vertical indent guide can changed in intellij idea when go preferences > editor > colors & fonts > general, select list item “vertical indent guide”. see screenshot . tested on mac os x intellij idea ultimate 14.1.4.

sql - LIKE and NOT LIKE in MySQL do not match total number of rows -

for example, have 100 row table varchar column. i run these queries: select count(*) mytable mytext '%hello%' select count(*) mytable mytext not '%hello%' i not getting total count of 100. not picking of rows reason. why happening? check null values, neither like nor not like count these.

python - general connection to a mysql server -

is there way make general connection mysql server , not 1 of databases? found following code snippet. connect method connects specific database called employees . import mysql.connector cnx = mysql.connector.connect(user='scott', password='tiger', host='127.0.0.1', database='employees') cnx.close() yes, can make same connection without specifying database name: cnx = mysql.connector.connect(user='scott', password='tiger', host='127.0.0.1') it same connecting terminal using: mysql -h 127.0.0.1 -u scott -ptiger note: 127.0.0.1 localhost. also, not store actual connection information in script. more (if can): def closeconnection(cnxin, cursorin): cursorin.close() cnxin.close return user = input('enter user name: ') user = user.strip() password = getpass.getpass() host = input('enter host name: ') host = host.strip() cnx = mysql.connector.connect(user=user, password...

Boxplot error R Studio: Error in boxplot.default(x = cataract_opths$pop.blind.cataract, range = 100) : adding class "factor" to an invalid object -

Image
i'm trying make simple boxplot following data: pop.blind.cataract 2,994,231 17,038,617 87,572 2,130,689 2,425,043 26,551,580 8,332,035 377,354 2,554,610 8,734 128,809 396,198 619,308 25,922 1,944,676 i've tried both these commands , gotten both these errors: boxplot( x=pop.blind.cataract, range=100) error in boxplot(x = pop.blind.cataract, range = 100) : object 'pop.blind.cataract' not found boxplot( x=cataract_opths$pop.blind.cataract, range=100) error in boxplot.default(x = cataract_opths$pop.blind.cataract, range = 100) : adding class "factor" invalid object i can't figure out what's going on. there no "na"s in data. numbers. can't figure out what's going on. please help! thanks. if understand question correctly, problem in data. commas cleaned , put character vector (use data.frame if like), this: pop.blind.cataract <- c(2994231, 17038617, 87572, 2130689, 2425043...

c# - Programmatically Load Embedded Resource File -

i implemented following code in order programatically build project/exe. in exe build, wanted store bunch of "actual files" inside of resources, streams. here's how i'm adding files resource file (singular), , embedding resource file compiler parameters: list<string> userfiles = new list<string>(); userfiles.addrange(helpers.getfilesinfolder(this.txt_publish_folder.text)); string folder = this.txt_package_location.text; folder = folder + "\\package_" + datetime.now.tolongtimestring().replace(":", "_").replace(".", "_"); directory.createdirectory(folder); compilerparameters parameters = new compilerparameters(); parameters.generateexecutable = true; parameters.includedebuginformation = true; parameters.generateinmemory = false; parameters.warninglevel = 3; parameters.compileroptions = "/optimize"; ...

java - Maven works from terminal, but not from Eclipse in Yosemite -

Image
i upgraded yosemite , maven stopped working. figured because environment variables not set, followed post , created environment.plist file. setting environment variables via launchd.conf no longer works in os x yosemite/el capitan/macos sierra? <?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> <key>label</key> <string>my.startup</string> <key>programarguments</key> <array> <string>sh</string> <string>-c</string> <string> launchctl setenv m2_home /applications/dev/apache-maven-2.2.1 launchctl setenv m2 /applications/dev/apache-maven-2.2.1/bin launchctl setenv java_home $(/usr/libexec/java_home) launchctl setenv path /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/...

sql - Find the column names of Temp table -

i need find column names of temp table . if physical table can either use sys.columns or information_schema.columns system views find column names. similarly there way find column names present in temp table? select * tempdb.sys.columns object_id = object_id('tempdb..#sometemptable');

arrays - Access python member from object without dict -

this small piece of application i'm having issues @ moment. import csv open('eggs.csv', 'rb') csvfile: reader = csv.dictreader(csvfile) row in reader: print(row['first_name'], row['cat']) print(row[1]) the application section runs fine no issues, wanted access each value 'row' means of ith element or through numerical value. however, doesn't seem function expected. is there specific way should doing access member items without having directly call column name. help , clarification appreciated. the csv module gives 2 broad ways of accessing data each line of file: by index, using reader ; or by key, using dictreader . however, note dictreader instance has fieldnames attribute, "a sequence elements associated fields of input data in order" , convert index key use: row[reader.fieldnames[1]]

android - Material translucent status bar with Material Navigation drawer and wallpaper -

i need job this: https://raw.githubusercontent.com/florent37/materialviewpager/master/screenshots/screenshot_2_small.png as can @ picture, there wallpaper translucent status bar on activity. im using : http://www.android4devs.com/2014/12/how-to-make-material-design-navigation-drawer.html for navigation drawer , here i'm done styles.xml <resources> <style name="apptheme" parent="android:theme.holo.light.darkactionbar"> <item name="android:windowtranslucentstatus">true</item> </style> </resources> and, in manifest : android:theme="@android:style/theme.holo.noactionbar.translucentdecor"> but wallpaper not in status bar completly. i dont have java code on application. so, how can add feature in application or above navigation drawer translucent status completly ? main_activity.xml : <relativelayout xmlns:android="http://schemas.android.com/apk/res/android...

My php page will display my html header include in the dreamweaver preview but not in a browser -

the snippet of include code in php file looks this. <div id="header"> <!--#include virtual="includes/frontpage_header.html" --> </div> and frontpage_header.html code looks this. <div style="float: left; width: 30%;"><a href="../index_new.php"><img id="headerlogo" src="../images/dynamichomes45th.png" alt="dynamic homes logo"/></a> </div> <div style="float: left; width: 33%;"> <h1>quality custom built homes</h1> </div> <div style="float: right; width: 33%;"> <div id="headernav"> <div id="whybuild"> <h2>why build dynamic</h2> <img src="../images/whybuildicon.png" alt=""/> </div> <div id="gallery"> <h2>gallery</h2> <img src="../images/galleryicon.png" width="43" height...

jquery - AngularJS ng-repeat: Change Array -

i want change categoryalpha different value (say, categorybeta ) in following html + angularjs: <div ng-repeat="x in categoryalpha | limitto:quantity"> <previews></previews> <hr /> </div> since ng-repeat isn't normal attribute, don't think can change through jquery attr() . solution regex, or there angular/jquery method can change value categoryalpha ? thanks in advance. you can example create function return collection ng-repeat , assign scope. like: // in controller $scope.getcategory = function getcategory() { return somecondition ? categoryalpha : categorybeta; }; and in markup: <div ng-repeat="x in getcategory() | limitto:quantity"> <previews></previews> <hr /> </div>

Huge file handling and sorting using python -

im working on program uses file having data in format - 6 columns , dynamic no. of rows. the file got testing 26 mb , following program converts first 3 columns 3 different lists. f = open('foo', 'r') print('running...') = [] b = [] c = [] line in f: x = (line.split(' ')) a.append(x[0]) b.append(x[1]) c.append(x[2]) print(a,b,c,sep='\n') i have rechecked program , logic looks correct , when implemented on small file works when use program 26 mb file stops responding. description of program: program opens file name 'foo' , implements line line of file. splits line parts based on separator defined argument in .split() method. in program have used white space separator in text file data separated using white spaces. im not able figure out why program stops responding , need it! if use numpy , can use genfromtxt : import numpy np a,b,c=np.genfromtxt('foo',usecols=[0,1,2],unpack=true) does wo...

c# - Resizing Windows Forms -

i have form it's formborderstyle set sizable. creates grip in bottom right. way resize window mouse right on edge. i'm wondering if there way change cursor able resize when user mouses on grip, or if can increase range @ allow resize on edge don't have precise mouse location. here link similar question. guy has no borders, may have little differently, should give direction go in. repaste code here completion: public partial class form1 : form { public form1() { initializecomponent(); this.formborderstyle = formborderstyle.none; this.doublebuffered = true; this.setstyle(controlstyles.resizeredraw, true); } private const int cgrip = 16; // grip size private const int ccaption = 32; // caption bar height; protected override void onpaint(painteventargs e) { rectangle rc = new rectangle(this.clientsize.width - cgrip, this.clientsize.height - cgrip, cgrip, cgrip); controlpaint.drawsizegrip(e.graphic...

python - How do I create a variable number of variables? -

how accomplish variable variables in python? here elaborative manual entry, instance: variable variables i have heard bad idea in general though, , security hole in python. true? use dictionaries accomplish this. dictionaries stores of keys , values. >>> dct = {'x': 1, 'y': 2, 'z': 3} >>> dct {'y': 2, 'x': 1, 'z': 3} >>> dct["y"] 2 you can use variable key names achieve effect of variable variables without security risk. >>> x = "spam" >>> z = {x: "eggs"} >>> z["spam"] 'eggs' make sense?

css - Using bootstrap icons in grid as command buttons -

i trying figure out how use bootstrap icons buttons commandnames in gridtemplatecolumn or gridbuttoncolumn. <telerik:gridtemplatecolumn uniquename="commands"> <itemtemplate> <asp:button id="btndelete" cssclass="glyphicon glyphicon-remove-sign" runat="server" /> </itemtemplate> </telerik:gridtemplatecolumn> <telerik:gridbuttoncolumn buttoncssclass="glyphicon glyphicon-minus-sign" /> at least trying make bootstrap icon act button not button, icon. change asp:button asp:linkbutton <itemtemplate> <asp:linkbutton id="btndelete" runat="server" cssclass="glyphicon-remove-sign"/> </itemtemplate>

cordova - Impossible to run ionic build android -

i have couple of days problem, upgrade new version ionic , present following problem: build failed total time: 11.556 secs /users/lixsys/app_view/platforms/android/cordova/node_modules/q/q.js:126 throw e; ^ error code 1 command: /users/lixsys/app_view/platforms/android/gradlew args: cdvbuilddebug,-b,/users/lixsys/app_view/platforms/android/build.gradle,-dorg.gradle.daemon=true error building 1 of platforms: error: /users/lixsys/app_view/platforms/android/cordova/build: command failed exit code 1 may not have required environment or os build project error: /users/lixsys/app_view/platforms/android/cordova/build: command failed exit code 1 @ childprocess.whendone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23) @ childprocess.emit (events.js:110:17) @ maybeclose (child_process.js:1008:16) @ process.childprocess._handle.onexit (child_process.js:1080:5) previously in cases had earned problem solve...

gps - interpolation/lookup in R -

i'm switching r excel , wondering how in r. have dataset looks this: df1<-data.frame(zipcode=c("7941ah","7941ag","7941ah","7941az"), from=c(2,30,45,1), to=c(20,38,57,8), type=c("even","mixed","odd","mixed"), gps=c(12345,54321,11221,22331)) df2<-data.frame(zipcode=c("7914ah", "7914ah", "7914ah", "7914ag","7914ag","7914az"), housenum=c(18, 19, 50, 32, 104,11)) first dataset contains zipcode, house number range (from , to), type meaning if range contains even, odd or mixed house numbers , gps coordinates. second dataset contains address (zipcode, house number). what want lookup gps coordinates df2. example address zipcode 7941ag , housenumber 18 (even number between 2 , 20) has gps coordinate 12345. update: didn't cross mind size of dataset i...

javascript - Is it possible to count how many times this bookmarklet is clicked and if so, how to get the number of clicks in to a file? -

i have javascript code uses iframes pull data required. made in bookmarklet. wanted know if possible count how many times bookmarklet clicked , if so, how number of clicks in file? original code: javascript:(function () { if (!$('#omniboxdiv').length) { var strload = '<div id="omniboxdiv" style="display: block;background-color: gold;font-size: 1.25em;z-index: 1000;position: fixed;width: 96%;padding: 2%; text-align: center">loading...</div>'; var divload = $(strload).prependto('body'); } if(typeof omnibox === 'object'){ omnibox.msg(); return; } omnibox = this; var fstatus = $('tr:has(td:contains("fstatus")):eq(1)>td:eq(1)').text(); var mstatus = $('tr:has(td:contains("mstatus")):eq(2)>td:eq(1)').text(); var flink = $('a:contains("f profile")').attr('href'); this.msg = function(){ '<tr><td></td...

python - Nested relationships in django rest framework -

i want register new user associated list of categories . i have table called categories list of unique categories ( category id, category name ). i have table called accounts list of users ( username, email, password , list of associated categories ). i have table called account_categories mapping between users , categories . unfortunately when trying create new user receive error provided categories exists. don't want update categories table. want update accounts , account_categories . what doing wrong? model.py class category(models.model): categoryname = models.charfield(unique=true, max_length=50) def __str__(self): return "{0}".format(self.categoryname) class accountmanager(baseusermanager): def create_user(self, email, age, categories, password=none, **kwargs): if not email: raise valueerror('users must have valid email address.') if not kwargs.get('username'): r...

jquery - Masonry items position change -

this masonry code. working fine problem item 4 not set last. can fix that? in advance. // external js: masonry.pkgd.js $(document).ready( function() { $('.grid').masonry({ itemselector: '.grid-item', columnwidth: '.grid-sizer', percentposition: true, gutter: 5, }); }); * { -webkit-box-sizing: border-box; box-sizing: border-box; } body { font-family: sans-serif; } /* ---- grid ---- */ .grid { background: #eee; max-width: 1200px; } /* clearfix */ .grid:after { content: ''; display: block; clear: both; } /* ---- grid-item ---- */ .grid-sizer, .grid-item { width: calc(15.71% - 5px); /*width: 15.71%;*/ } .grid-item { height: 120px; float: left; background: #d26; border: 2px solid #333; border-color: hsla(0, 0%, 0%, 0.5); border-radius: 5px; } /*.grid-item--width2 { width: 20.3% } .grid-item--width3 { width: 31.42%; }*/ .grid...

sql - Update table using random of multiple values in other table -

consider data: create table #data (dataid int, code varchar(2), prefix varchar(3)) insert #data (dataid, code) values (1, 'aa') , (2, 'aa') , (3, 'aa') , (4, 'aa') , (5, 'aa') , (6, 'aa') create table #prefix (code varchar(2), prefix varchar(3)) insert #prefix (code, prefix) values ('aa', 'abc') , ('aa', 'def') , ('aa', 'ghi') , ('aa', 'jkl') i want set prefix value in #data random prefix #prefix matching code . using straight inner join results in 1 value being used: update d set prefix = p.prefix #data d inner join #prefix p on d.code = p.code from reading other questions on here, newid() recommended way of randomly ordering something. changing join to: select top 1 subquery ordering newid() still selects single value (though random each time) every row: update d set prefix = (select top 1 p.prefix #prefix p p.code = d.code order newid()) #dat...

sql - db2 select statement with group and sum -

i have data in db2 need query for... location | part | quantity -------------------------- loc1 td3 300 loc1 ra5 0 loc2 mo2 8 loc2 cy1 9 loc2 bl5 6 loc4 ra5 50 loc4 pl5 5 loc3 yt7 2 loc3 ua9 5 the result set return 'location's have less 10 'quantity' of 'part's . 'part' doesn't need included in result set. in result set, sum total of quantities well. in case above, result set. location | total quantity ------------------------- loc2 23 loc3 7 this needs sql query database db2 i see. isn't quite duplicate of last question. minor tweak on query: select location, sum(quantity) db2 group location having max(quantity) < 10;

Update a row(entity) in a table only if a change detected(automatically) -

sorry bad english :( i'm using cakephp 3 framework , want update row (entity) in table if a change detected (automatically). eg.: $id = 1; // debug($this->request->data) $this->request->data = ['id' => 1, 'name' => "my name", 'content' => "my content"]; // inside articlescontroller $article = $this->articles->get($id); // debug($article) object(cake\orm\entity) { 'id' => (int) 1, 'name' => "my name", 'content' => "my content", '[new]' => false, '[accessible]' => [ '*' => true ], '[dirty]' => [], '[original]' => [], '[virtual]' => [], '[errors]' => [], '[repository]' => 'articles' } there no difference between the request data , the original data have reject update query , return warning user ...

android - How to change background image of EditText by SharedPreference choice? -

i have been trying without success change background image of edittext using preference choice. don't know why isn't working. here code: preferences = getsharedpreferences("prefborder", 0); string value = preferences.getstring("solid", null); if (value.equals("solid")) { edittext.setbackgroundresource(r.drawable.border); // key not exist } else { // handle value edittext.setbackgroundresource(r.drawable.borderpkmnblue); } here preference values borders: <string-array name="border"> <item name="solid">solid</item> <item name="pokemonblue">pokemon blue</item> </string-array> <string-array name="bordervalues"> <item name="solid">drawable/border.png</item> <item name="pokemonblue">drawable/borderpkmnblue.png</item> </string-array> try using setbackgrounddrawable() meth...

sql - Trouble using temp table in where clause -

i'm creating report user can select between 2 statuses of field. default completed status , any . if selected status not completed , needs ignore or select values. created temp table of distinct values , set local variable. i'm trying use case statement , temp table in where clause handle this, it's not letting me. there better way handle other setting sql string , exec'ing it? declare @paramcompleted varchar(20) = 'completed' declare @paramcommitmentexamined varchar(20) = 'requested' declare @paramdatefrom date declare @paramdateto date declare @purchstatus table([status] varchar(15)) insert @purchstatus([status]) select distinct tx01stat dimfile_t order tx01stat --select * @purchstatus select dbo.parsedate(o.orddate) orddate, t.tx04stat,--commitment examined & type e.examiner, t.tx02stat,--outside search c.county, s.settstat, case when l.loanamt = 0 'cash' else cast(l.loanamt varchar(...

unit testing - How to mock a redis client in Python? -

i found bunch of unit tests failing, due developer hasn't mocked out dependency redis client within test. i'm trying give hand in matter have difficulties myself. the method writes redis client: redis_client = get_redis_client() redis_client.set('temp-facility-data', cpickle.dumps(df)) later in assert result retrieved: res = cpickle.loads(get_redis_client().get('temp-facility-data')) expected = pd.series([set([1, 2, 3, 4, 5])], index=[1]) assert_series_equal(res.variation_pks, expected) i managed patch redis client's get() , set() successfully. @mock.patch('redis.strictredis.get') @mock.patch('redis.strictredis.set') def test_identical(self, mock_redis_set, mock_redis_get): mock_redis_get.return_value = ??? f2 = deepcopy(self.f) f3 = deepcopy(self.f) f2.pk = 2 f3.pk = 3 self.one_row(f2, f3) but don't know how set return_value of get() set() set in code, test pass. right line fails test: res...

java - Draw triangle with rounded corner -

i draw triangle vertices bit smoothed in java swing. learnt how draw triangle these lines of code polygon p=new polygon (vertice_x, vertices_y, number_of_vertices); g.drawpolygon(p); but i've found nothing rounded corners. read there method in graphics2d lets draw rectangle rounded borders general polygon? how should that? for more control on rounded corners (beyond using stroke ), can combine 3 lines sides, , 3 bezier curves rounded corners. use linear interpolation start/end point of lines , curves, corner points being control point curves. public point interpolate(point p1, point p2, double t){ return new point((int)math.round(p1.x * (1-t) + p2.x*t), (int)math.round(p1.y * (1-t) + p2.y*t)); } point p1 = new point(50,10); point p2 = new point(10,100); point p3 = new point(100,100); point p1p2a = interpolate(p1, p2, 0.2); point p1p2b = interpolate(p1, p2, 0.8); point p2p3a = interpolate(p2, p3, 0.2); point p2p3b = interpolate(p2, p3, 0.8); p...

android - ARC welder camera access with OpenCV -

does know how use opencv camera frames on arc welder ? i'm using native code here. opencv easiest way frames on android. i'm having troubles on arc. seems looking packages don't exist : d/opencv::camera( 204): cvcapture_android::cvcapture_android(0) d/opencv::camera( 204): library name: libbitmaptoolkit.so d/opencv::camera( 204): library base address: 0xde0c0000 e/opencv::camera( 204): not read /proc/self/smaps d/opencv::camera( 204): trying find native camera in default opencv packages d/opencv::camera( 204): trying package "org.opencv.lib_v24_armv7a" ("/data/data/org.opencv.lib_v24_armv7a/lib/") d/opencv::camera( 204): package not found d/opencv::camera( 204): trying package "org.opencv.engine" ("/data/data/org.opencv.engine/lib/") d/opencv::camera( 204): package not found d/opencv::camera( 204): camerawrapperconnector::connecttolib: folderpath= e/opencv::camera( 204): camerawrapperconnector::connecttolib error: can...

How to Use JDO with Google App Engine Modules Java -

i'm trying use jdo datastore, in gae java modules app. have created 2 dynamic web projects gae runtime. created ear project, add 2 dynamic web projects ear. tried "run on server". got following error. org.datanucleus.exceptions.classnotpersistableexception: class "mybeanclass" not persistable. means either hasnt been enhanced, or enhanced version of file not in classpath (or hidden unenhanced version), or meta-data/annotations class not found. tried enabling jpa facet also. please help. thanks. i solved problem after lot of trail , errors. i wanted post solution might others. creating dynamic web project , enabling jpa didn't work me. i created dynamic web project, while creating selected, google app engine jpa. solved problem. thanks..!!

javascript - Restify returns undefined is not a function in error object -

i have below restify custom error being thrown catch block of bluebird promise. var test = function() { respobject = { hello: { world: 'aasas' } }; throw new restify.errors.serviceerror(respobject, 422); } then in serviceerror: function serviceerror(respobject, statuscode) { restify.resterror.call(this, { restcode: 'apierror', statuscode, statuscode, message: 'api error occurred', constructoropt: serviceerror, body: { message: 'api error occurrede', errors: respobject.tojson() } }); this.name = 'customapierror'; } util.inherits(serviceerror, restify.resterror); restify.errors.serviceerror = serviceerror; however on calling function of test() : test().catch(function(err) { console.log(err); }); it's returning undefined not function . there reason why it's not returning err object above calling function under catch block? the problem isn't restify, it's tes...

json - Google Direction API Error: "Invalid request. Missing the 'destination' parameter." -

i trying curl google direction api json output using instructions provided https://developers.google.com/maps/documentation/directions/?csw=1#json i have tried (this found on google directions api documentation) curl https://maps.googleapis.com/maps/api/directions/json?origin=toledo&destination=madrid&region=es&key=my_api_key with following output: curl https://maps.googleapis.com/maps/api/directions/json?origin=toledo&destination=madrid&region=es&key=aizasydsgikndyh_kdv17bk2ytetnhaitshp5ts [1] 4174 [2] 4175 [3] 4176 [2] done destination=madrid roberts-macintosh:~ robertloggia$ { "error_message" : "invalid request. missing 'destination' parameter.", "routes" : [], "status" : "request_denied" } [1]- done curl https://maps.googleapis.com/maps/api/directions/json?origin=toledo [3]+ done region=es i have enabled google direct...

Permutation of words in elasticsearch -

in elasticsearch treat documents identical in case values of specific text field differ order of terms. how can accomplish in elasticsearch? update, more detailed formulation of goal: given have 5 documents phrases 1) "iphone white", 2) "white iphone", 3) "white iphones", 4) "black iphone" , 5) "white android" (where first 3 phrases consist of 2 basic terms "white" , "iphone") when search "iphone", then 2 results, example "iphone white" , "black iphone" (such avoid duplications due permutations of words). the result want each distinct combination of basic terms distinct phrase has highest score in elasticsearch query. in example there 2 distinct combinations of basic terms matches query: a) "iphone"+"white" , b) "iphone"+"black". phrases 1,2,3 match , b phrase 4 matches. phrase 1 phrase highest score...

php - how can i print all Items with x tag -

i have 3 related table in mysql, this: table: items columns: id, item_id, item_title, content table: tags columns: tag_id, tag_title table: items_tags columns: item_id, tag_id item_id foreign key in items table. items_tags correlation table. now want print items x tag. for example: // items +-----+-----+---------+-----------------+ | 1 | 123 | tile1 | content1 | ----------------------------------------- | 2 | 123 | tile2 | content2 | ----------------------------------------- | 3 | 444 | tile3 | content3 | ----------------------------------------- | 4 | 333 | tile4 | content4 | ----------------------------------------- // tags +------+-----+ | 22 | php | -------------- | 23 | js | -------------- | 11 | sql | -------------- // item_tags +-------+-----+ | 123 | 22 | --------------- | 444 | 23 | --------------- | 333 | 11 | --------------- i not know why i'm confused, know should use join , how ?! ho...

how to configure entity framework 6 for sqlite in visual studio 2013 -

Image
how can configure entity framework 6.x sqlite in visual studio 2013. want configure win-form application sqlite entity framework 6.x. need process step step described. i tried solutions, no 1 straight forward specific system requirement. there questions similar this, in asking resolve problem. point that, want neat step step process this, people can straight forward way thing. currently have installed data provided .net framework 4.5.1 here , entity framework 6.0.2 sqlite nuget . when adding ado.net entity data model, there no provider listed sqlite db connection. close vs. go page: http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki search on page: setups 32-bit windows (.net framework 4.5.1) , download bundle vs 2013 (the 1 sais it's 1 installs packages vs 2013 in bold letters). make sure save dlls gac , install design time components (this take time). start vs. you should able add connections sqlite database file now.

android - Calling ParseUser.save deletes Session -

i use parse.com backend android. i want sign new user , after set data field on user object. important me set data field after sign up, because later want enable automatic acl setting using beforesave triggers (currently no triggers activated!). what happens following: sign completes , after set data field , call currentuser.save . savecallback not called @ (neither error, nor successfully). however, of times called session user deleted. can check in data browser. also, invalid session exceptions if try after that. here's code: final user user = getdata(); user.setemail(emailstr); user.setusername(emailstr); user.setpassword(password); user.signupinbackground(new signupcallback() { @override public void done(parseexception e) { if (e == null) { // more complex data in future user.getcurrentuser().put("testint", 5); user.getcurrentuser().saveinbackground(new savecallback() { @override ...

oracle - Optional output cursor as parameter -

i'm trying cater 2 applications. one calls procedure 2 cursors, other 1. both out sys_refcursor . because of difference in definition of procedure, change 1 application break other. i wondering if possible have same procedure both out sys_refcursor second parameter optional. done in other parts of project defining default value. i have tried googling , defining default values no avail. doesnt seem common issue. is there way have definition optional out sys_refcursor ? here code: procedure proc_getq (qlist out sys_refcursor, qstack out sys_refcursor); i qstack optional. thanks, jfit what method overloading ? procedure proc_getq (qlist out sys_refcursor, qstack out sys_refcursor); procedure proc_getq (qlist out sys_refcursor); create procedure same name, similar logic (better call 2-parameter version inside , pass 1 outside), 1 out parameter.

R: catch message, return result (efficiently) -

consider function: hello_world <- function() { message("hello world") "goodbye world" } with constraint of being allowed call function once (e.g. expensive computation), how value function call and catch message (for handling)? i'm thinking of caching value in environment of trycatch() call, can't work out how it. here 2 non-examples : # example 1 trycatch( hello_world(), message = function(x) { cat("the message is: ", x$message, "\n") } ) # example 2 trycatch( hello_world(), message = function(x) { cat("the message is: ", x$message, "\n") hello_world() } ) here example using sink : messagehandler <- function(fun, ...) { zz <- textconnection("foo", "w", local = true) sink(zz, type = "message") res <- fun(...) sink(type = "message") close(zz) #handle messages list(res, messages = foo) } messageh...

javascript - extract vimeo video id from the url -

though question available on so, facing little problem.i failed extract vimeo id using vimeo regex used here: vimeo regex my codes i,m using now: function vimeoprocess(url){ var vimeoreg = /https?:\/\/(?:www\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|)(\d+)(?:$|\/|\?)/; var match = url.match(vimeoreg); if (match){ console.log(match[3]); }else{ return "<span class='error'>error</span>"; } } it not consoles thing. can 1 help? this "magic regex" not magic. not work url you're using, instance. here's parser set : var urls = [ "https://vimeo.com/11111111", "http://vimeo.com/11111111", "https://www.vimeo.com/11111111", "http://www.vimeo.com/11111111", "https://vimeo.com/channels/11111111", "http://vimeo.com/channels/11111111", "https://vimeo.com/channels/mychanne...

c# - ReSharper Documentation Tags Formatting One Per Line -

Image
i'm trying resharper behave when creating xml comments. when see preview looks how want when document method or class isn't formatting per preview. i this: /// <summary> /// trace. /// </summary> /// <param name="level"> /// level. /// </param> /// <param name="tag"> /// tag. /// </param> /// <param name="message"> /// message. /// </param> /// <param name="args"> /// args. /// </param> when in fact preview (and want) looks this: /// <summary> trace. </summary> /// <param name="level"> level. </param> /// <param name="tag"> tag. </param> /// <param name="message"> message. </param> /// <param name="args"> args. </param> i've tried saving these settings machine wide , far can tell sol...

networking - Work with multiple NICs/networks in Windows -

i'm searching solution work on windows machine multiple nics/networks. while working within network of customer tend lot of problems. need internet connection several things git/sourcesafe/development system etc. clients can't offer internet access. solution use mobilephone connect internet , ethernet access client network/database. windows seems pretty random here. works, mintues later trys access internet on clients gataway or access database via internet. end deactivting/activating nic's day long. is there easy way use ethernet connection access clients network , mobile else? from described think might help: turn off dhcp interface connects customers network , set static address (without gateway). configure other interface use dhcp. should set 1 default gateway (your phone) , traffic run through it, except endpoints in customer's net. btw: can have 1 default gateway @ time, of course, in case gateway set latest won, speak.

android - Read logs from Logcat without killing the tablet -

i have read logs logcat , send them server through udp. for task have used code: https://github.com/chemik/logcatudp the main problem of code async thread launched enters while(true) loop drains tablet's battery on long run. is there way logs in real time without using busy wait that? without adding sleep(some_milliseconds) reduce problem? it great use sort of event listener haven't found one. have searched in every similar library without success. the code following: while (true) { string sendingline = ""; // assume log writes whole lines if (bufferedreader.ready()) { logline = bufferedreader.readline(); sendingline += logline + system.getproperty("line.separator"); datagrampacket packet = new datagrampacket(sendingline.getbytes(), sendingline.length(), inetaddress.getbyname(mconfig.mdestserver), mconfig.mdestport); try { msocket.send(packet); ... a...

Jquery waypoints - destroy sticky when parent element is 50% passed -

im sure simple have been @ bit , cant seem syntax right. have series of sections containing captions fixed top when parent hits top of page. want destroy sticky when parent element 50% past top cant seem right. heres declare waypoints - ive tried writing handler within target captions , destroy waypoint havent gotten working. $('.content').each(function() { new waypoint.inview({ element: this, enter: function(direction) { $(this.element).addclass('active') }, exited: function(direction) { $(this.element).removeclass('active') } }) new waypoint.sticky({ element: $(this).children('.caption') }) });

How can I parse an outlook table using vba, to automatically update quickparts? -

i have tried find answer question without success, apologies if has been asked before. i have outlook message table containing table, want parse using vba create or update quick part entries. the table looks : +-----+--------------+--------------+ | xxx | | b | +-----+--------------+--------------+ | 1 | samplea1 | sampleb1 | +-----+--------------+--------------+ | 2 | samplea2 | sampleb2 | +-----+--------------+--------------+ | 3 | samplea3 | sampleb3 | +-----+--------------+--------------+ my objective generate quick parts id example "xxxa1" , corresponding text "samplea1". the id constructed first cell of table , row , column headers, , values corresponding cell contents. i hope clear. any appreciated. chris ok, i've managed read table, can't find how access quickparts store i've read. my code far looks this. sub parsetable2quickparts() dim objol outlook.applicatio...

javascript - Change the back button URL in browser -

i want disallow visitor go in browser, tried code here ( how disable button in browser using javascript ) , works well, want make somenthing more useful application. want change url. so, if url mywebsite.com/admin/add_new_article.php want change url mywebsite.com/admin/index.php thank all! <script type="text/javascript"> history.pushstate(null, null, '<?php echo $_server["request_uri"]; ?>'); window.addeventlistener('popstate', function(event) { window.location.assign("http://www.yoururl.com/"); }); </script> hope helps!

internationalization - Getting the alphabet of a language from the Locale in Java -

i making internationalized app in java. need list of letters in language, starting locale. there questions alphabet constant in java? or create alphabet list list : java touch on issue, i'm wondering there utils class or it's defined , can list of chars or string containing letters in alphabet of language it's locale. you can refer library , methods in detail, com.ibm.icu.util.localedata . pass argument locale.english alphabets of english.

node.js - Javascript (node) error: Unexpected token function -

i trying learn younode workshop, make modular step precise. wrote code in link , getting "error in title". have checked brackets , parenthesis can not seem find got wrong. appreciated (i started node). code , can find @ link: http://pastebin.com/g8x2gh7h module.exports = function (directorypath, extention, function(error, arrayofnames) { var fs = require('fs'); var path = require('path'); var filenamesarray = []; fs.readdir(directorypath,function (error,list){ list.foreach(function (file) { if (path.extname(file) === '.' + extention) { filenamesarray.push(file); } }); }); return filenamesarray; }){ return arrayofnames; } your problem declaring function inside of function declaration.

jsf - Omnifaces - ListIndexConverter, principle of operation -

i try understand principle of operation of omnifaces.converter.listindexconverter @facesconverter("omnifaces.listindexconverter") public class listindexconverter implements converter { private static final string error_list_index_bounds = "index {0} value {1} in component {2} out of bounds."; private static final string error_value_not_in_list = "object {0} in component {1} not appear present in given list."; private list<?> list; @override public object getasobject(facescontext context, uicomponent component, string value) { int index = integer.valueof(value); if (index < 0 || index >= list.size()) { throw new converterexception( createerror(error_list_index_bounds, index, value, component.getclientid(context)) ); } return list.get(index); } @override public string getasstring(facescontext context, uicomponent component, object value) { (int = 0; < list.size(); i++)...

html - How correctly specify the textarea width? Using the cols attribute I obtain different width using different browser -

Image
i have problem definition of width of textarea so, have situation: <div id="dialogreject" title=""> <table style="visibility: hidden;" id="rifiutatable" border="0" class="standard-table-cls" style="width: 100%!important"> <tbody style="background-color: #ffffff;"> <tr> <td style="font: 16px verdana,geneva,arial,helvetica,sans-serif !important">inserire note di rifiuto</td> </tr> <tr> <td> <textarea style="visibility: hidden;" rows="5" cols="70" id="myrejectnote"></textarea> </td> </tr> <tr> <td> <input class="bottone" readonly="readonly" type="text" valu...

bash - unterminated address regex on sed command -

im trying write xml tag in file. , want above tag script.sh sudo chmod 777 attribute-filter.xml configure_attribute_filter_tag1='<afp:attributefilterpolicy id="uid">' configure_attribute_filter_tag12='</afp:attributefilterpolicy>' configure_attribute_filter_var='<afp:attributefilterpolicy id="releasetransientidtoanyone">' sed -i '/'$configure_attribute_filter_var'/i \'"$configure_attribute_filter_tag1"'' attribute-filter.xml sed -i '/'$configure_attribute_filter_var'/i \'"$configure_attribute_filter_tag12"'' attribute-filter.xml attribute-filter.xml <afp:attributefilterpolicy id="releasetransientidtoanyone"> <afp:policyrequirementrule xsi:type="basic:any"/> <afp:attributerule attributeid="transientid"> <afp:permitvaluerule xsi:type="basic:any"/> ...

amazon web services - UpdatePolicy in Autoscaling group not working correctly for AWS CloudFormation update -

i using aws cloudformation launch server stack. have created launchconfig , autoscaling group uses above launchconfig. have set creationpolicy waits signals ec2 instances creating cf stack. also, have set updatepolicy autoscaling group wait signals new instances if update cf stack more desired number of instances follows: "updatepolicy" : { "autoscalingrollingupdate" : { "pausetime" : "pt10m", "waitonresourcesignals" : "true" } } according above, cf should wait signals newly launched instances (or timed out) before setting status of cf stack "update_comple". but not working explained above. status of cf stack changes "update_comple" w/o waiting signals. please help.

d3.js - assign text to rectangles not working -

i dynamically creating rectangles , assigning 1 of data values text rectangle. in developer tools can see value not on rectangles. code: var x = d3.scale.linear().domain([0, data.length]).range([0, 1200]); console.log(filtereddata); rectangle= svg.selectall("rect").data(filtereddata).enter().append("g").append("rect"); rectangleattrb = rectangle .attr("id", function (d,i) { return "rectid" + ; }) .attr("x", function (d,i) { return x(i); }) .attr("y", function (d,i) { return 40; }) .attr("width",function(d,i) { if(d.value <100) ...