Posts

Showing posts from June, 2013

android - What is wrong with my vibrate? -

since added vibrator app crashes? code: package com.flag.fun; import android.app.*; import android.content.*; import android.media.*; import android.os.*; import android.os.vibrator; import android.view.*; import android.widget.*; public class lvl01activity extends activity { edittext input; sharedpreferences somedata; public int n; public static string filename = "myfile"; int p = 0; int = 0; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.lvl01); final vibrator k = (vibrator) getsystemservice(context.vibrator_service); somedata = getsharedpreferences(filename, 0); final mediaplayer soundright = mediaplayer.create(lvl01activity.this, r.raw.right); final mediaplayer soundwrong = mediaplayer.create(lvl01activity.this, r.raw.wrong); final textview lvl01tv = (textview) findviewbyid(r.id.lvl01answer); final imageview lvl01iv = (imageview) findviewbyid(r.id.lvl01d...

css - Can anyone help styling a view in drupal? -

i'm trying style views-slideshow on drupal site, once know how style 1 part of slideshow can style rest. have div on view want style , i'm having trouble putting border color on it? div ... <div class="views-field views-field-field-slide-image"> if can how style , great thanks this old link, i'm sure it's useful you: http://www.group42.ca/theming_views_2_the_basics basically have create new files , put in theme. name of files depends on view. , module recomends names. on other hand, can add border using css, add example: .views-field-field-slide-image { border: solid 1px #000000; } regards.

php - Deselect certain keys in array -

i populating forms using array. working fine want unset array key fields. after field again want keys value back. i can use unset remove key further use. here have , want get. $fields = array( 'type' => 'text', 'class' => 'col-6', 'name' => 'my-name', 'container' => 'col-12', 'id' => 'my-id', ); foreach($fields $value) { switch ($value['type']) { case 'text': echo array_key_exists('field_class', $value) ? '<div class="' . $value['container'] . '">' : null; // here want unset 'container' , 'id' keys echo form_input($value); // here want 'container' , 'id' value (i need 'id' badk reason) echo array_key_exists('container', $value) ? '</div>' : null; ...

osx - Yesod Binary Unavailable -

i have installed mac os x haskell platform here: http://www.haskell.org/platform/mac.html > ghc /usr/bin/ghc > ghci /usr/bin/ghci >cabal update ----- >cabal install cabal-install ----- >cabal install yesod ----- >yesod init -bash: yesod: command not found >which yesod >ghc-pkg list .... yesod-1.2.5.2 yesod-auth-1.3.0.4 yesod-core-1.2.13 yesod-form-1.3.8.2 yesod-persistent-1.2.2.3 yesod-routes-1.2.0.6 why did cabal fail create yesod binary? how fix install? how check yesod installed manually create symlink? why did cabal fail create yesod binary? how fix install? the yesod binary isn't part of yesod package anymore. instead, has been extracted yesod-bin package: cabal install yesod-bin the binary should in ~/library/haskell/bin , however, i'm not osx user.

c# - wpf Ribbon dataTemplating -

i'm new wpf, maybe don't understand mvvm correctly. use microsoft ribbon , need make ribbon dynamic tabs, whick bind viewmodel. in such way: <ribbon grid.row="1" itemssource="{binding avaliableplugins}"> <ribbon.applicationmenu> <ribbonapplicationmenu smallimagesource="images\gear_32.png" keytip="f"> <ribbonapplicationmenuitem header="exit" imagesource="images\stop_32.png" command="{binding closecommand}" /> <ribbonapplicationmenuitem header ="about" imagesource="images\bookmark.png" click="showabout"></ribbonapplicationmenuitem> </ribbonapplicationmenu> </ribbon.applicationmenu> <ribbon.itemtemplate> <datatemplate> <ribbontab > <ribbontabheader> <gri...

specifying javascript string split size -

i want separete text split function this. array items should 3 charecters. var text = "abcdef"; var splitted = ["abc", "def"] var text = "abcdefg"; var splitted = ["a", "bcd", "efg"] var text = "abcdefgk"; var splitted = ["ab", "cde", "fgk"] text split last first. var size = 3; //specify size here var str = "abcdefgk" //the string want split var = str.length % 3; // modulo gets remaining part var result = [str.substring(0,i)]; //create array first part //for rest, iterate on str , add chunks of length size for(; < str.length; i+=size){ result.push(str.substring(i, i+size)) } alert(result) //display result

c# - How to get all appointments including the private ones? -

i want list outlook appointment times in specific time range , interested in start , end time of appointments. i'm using code far: datetime starttime = datetime.now.adddays(2); datetime endtime = datetime.now.adddays(3); var outlookapplication = new outlook.application(); outlook.namespace outlooknamespace = outlookapplication.getnamespace("mapi"); var recip = outlooknamespace.createrecipient("<valid contact>"); if (recip.resolve()) { var calendaritems = outlooknamespace.getshareddefaultfolder(recip, oldefaultfolders.olfoldercalendar).items; calendaritems.includerecurrences = true; var filter = string.format("[start] >= '{0}' , [end] < '{1}'", starttime.toshortdatestring(), endtime.toshortdatestring()); calendaritems.sort("[start]"); calendaritems = calendaritems.restrict(filter); var result = calendaritems.cast<appointmentitem>().select(x => x); } the code retrieves...

TLama's CustomPage for Serial Number in Inno Setup -

tlama's code creating serial number page shown here custompage serial number in inno setup currently detects ctrl+v pasting in serial number; how can changed detect shift+ins?

gwtp - Why canReveal() of GateKeeper was called before the EventHandler was called (GWT)? -

i got header presenter nested presenter. customer presenter child of header presenter (ie customer presenter put slot of header presenter). so want use mygatekeeper manage login page. headerpresenter fire passuserinfoevent. public class mygatekeeper implements gatekeeper{ private string logineduserid=""; private final eventbus eventbus; @inject public mygatekeeper (final eventbus eventbus){ this.eventbus = eventbus; this.eventbus.addhandler(passuserinfoevent.gettype(), new passuserinfohandler(){ @override public void onpassuserinfo(passuserinfoevent event) { // todo auto-generated method stub string userid=event.getuserid(); logineduserid=userid; } }); } @override public boolean canreveal(){ system.out.println(logineduserid+"test"); if(!logineduserid.equals("")){ system.out.println(loginedusermeaningid+"cxcxc"); return true; } ...

AngularJS Fancybox Popup -

i have started angularjs project , implement fancybox. for this, have included jquery , fancybox plugins solution. attempting open template in code shown below in fancybox window. view <a href="" ng-click="openpage('popups/add.html')">add</a> controller app.controller('maincontroller', function maincontroller($scope) { $scope.user = "hey welcome"; $scope.open = function(template_path){ $.fancybox({"href":template_path}) } } ) and popup/add.html <div class="pop-contnr"> <h2>add</h2> <table> <thead> <tr> <th align=center>{{user}}</th> </tr> </thead> </table> </div> fancybox opens window containing template, {{user}} expression has not been evaluated. can please help? i have created directive fancybox...

jquery - Getting Backbone,JS to load more than one Collection into a single View? -

i have little bit of issue, not sure if not understand or if trying not possible. have database loads text, simple plan text on 2 different pages, home , about. now trying load data / text editable div (contenteditable set true) using backbone.js underscore.js template. var textview = backbone.view.extend({ el: $(".loader"), //template loader placeholder render: function() { var = this; var abouttxt = new aboutcollection(); //get page text var hometxt = new homecollection(); //get home page text abouttxt.fetch({ success: function(abouttxt) { var basictxt = _.template( $('script.basictext').html(), { abouttxt: abouttxt.tojson() } ); //load text template that.$el.html(basictxt) } }); } //end of render view function }); so main question is, can load more 1 collection view, or should / load more 1 url collection? each of collections have point different...

backbone.js - backbonejs + angularjs integration -

do have experience integrating angularjs component existing backbonejs application? briefly give me help, should make work? thank you igor i able make work after future reference - gist helped me lot: https://gist.github.com/dgs700/6197687 anyway, charles right - not nice combine these 2 frameworks (in case, not call so...)

php - inserting the data if the column name matches with it -

i trying insert data database. in database have columns this: mid, 1,2,3,4,5 till 31 and when user registers (here mid month id 1 12) , take date on day $date_of_admit=date('y-m-d'); list($year, $month, $day) =explode("-",$date_of_admit); $month = (int)$month; now, have insert 'p' day matches, if day 4 should insert 'p' in column 4 . not getting how proceed. please suggest updated $selquery = "select * attendance"; $columnname = mysql_field_name($selquery, $day); if can column name can achive couldnt

about converting the content of the uiview to the texture, OpenGL es -

i want convert content of uiview, showing in screen @ present, opengl es textures. but, while this, met trouble. size of textures, processed opengl es, size of input image. while texture rendered screen, size of uiview, showing content of textures, has been changed. so, if directly read content of uiview, following code, (_drawview belongs class of uiview) //convert current uiview texture, opengl es glubyte *pixelbuffer = (glubyte *)malloc(4 * _drawview.bounds.size.width * _drawview.bounds.size.height); cgcolorspaceref colourspace = cgcolorspacecreatedevicergb(); cgcontextref context = cgbitmapcontextcreate(pixelbuffer, _drawview.bounds.size.width, _drawview.bounds.size.height, 8, 4* _drawview.bounds.size.width, colourspace, kcgimagealphapremultipliedlast | kcgbitmapbyteorder32big); cgcolorspacerelease(colourspace); nslog(@"_drawview.bounds.s...

What is the formatter %@ in Objective-c -

what %@ means when it's using nslog? , when use that? nsdate* d = [nsdate datewithtimeintervalsincenow:1201921383]; nslog(@"result: %@",d); objective-c object, printed string returned descriptionwithlocale : if available, or description otherwise. works cftyperef objects, returning result of cfcopydescription function. https://developer.apple.com/library/mac/documentation/cocoa/conceptual/strings/articles/formatspecifiers.html

java - Sorting algorithms - how to implement my classes in main :) -

it's silly problem. have own comparator interface, class student - it's objects sorted, class bubblesort bubblesorting algorithm , main. think every class except main written quite well, have problem implementation of them in main make sorting start :/ i've created arraylist of random students want sorted, have problem bubblesort class , have no idea, how start. in future (i hope today :)) same classes containing sorting algorithms bubblesort here. think implementation in main identical. import java.util.random; import java.util.arraylist; public class program { public static void main(string[] args) { int elements = 100000; arraylist<student> list = new arraylist<student>(); random rand = new random(); (int i=0; i<elements; i++) { list.add(new student(rand.nextint(4)+2, rand.nextint(900000))); } system.out.println(list); } } . import java.util.arraylist; public class bubblesor...

javascript - Change URL dynamically depending on datepicker's value angular.js -

<label>from</label> <input type="text" datepicker-popup="dd-mm-yyyy" ng-model="startdate"/> <label>to</label> <input type="text" datepicker-popup="dd-mm-yyyy" ng-model="enddate"/> the url route : get /admin/api/stats controllers.adminstatsapi.get(start: option[localdate], end: option[localdate], computediff: boolean ?= false) my question how can change url depending on date (value) entered in datepicker . you have given insufficient information. use? ui-router? $location? but can that: var changeurl = function(startdate, enddate){ //do url change whatever thing using change url } $scope.$watch('startdate', function(newvalue){ var start = newvalue; var end = $scope.enddate; //do url change here changeurl(start, end); }, true); $scope.$watch('enddate', function(newvalue){ var start = $s...

google chrome - Always the smallest picture from srcset is chosen -

we had approach use srcset attribute provide not different resolution different image section within responsive design. alternative image url associated "320w" in order show on smartphones in portrait mode. since chrome supporting srcset turns out browser chooses small image regardless of actual viewport, due lower filesize. mean have resort other attributes , javascript again?

Conserve Steam cookies over PHP script -

for personnal project, have prices of item on community market. simple, can take item : http://steamcommunity.com/market/listings/730/stattrak%e2%84%a2%20p250%20%7c%20steel%20disruption%20%28factory%20new%29 . simply, have php script getting ten prices of page , displaying them. problem is, unless you're connected, steam shows prices in currency seller uses (so can euro as dollar). problem have convert , it's pretty... difficult. idea use chrome cookies , use curl page, , have prices in euro. can me how ? thank in advance thomas

Dll is confused with a windows-dll with same name causing file-in-use dialog in WiX-Setup -

i made several setups wix suppressing of "files-in-use"- , "please restart app/computer now/later"-dialogs setting following properties: <property id="reinstallmode" value="amus" /> <property id="msirestartmanagercontrol" value="disable" /> <property id="reboot" value="suppress" /> but 1 product comes dll named "kernelbase.dll" still prompting file-in-use dialog on uninstall, listing weird standard-windows applications cmd, paint, notepad, ... can press "ignore" or "try-again" proceed. uninstallation succeeds , no files left. the problem seems our kernelbase.dll in c:\program files (x86)\productname\ confused kernelbase.dll.mui c:\windows\syswow64\de-de\ . after renaming our dll file-in-use dialog didn't show anymore. i can't believe dlls referenced names. dont know dll registration, fullpath seems common uid dll, screwed list wind...

java - Interface method referencing a concrete class as parameter causes coupling? -

i thinking programming interfaces , not concrete classes, had doubt: should interface method able hold references concrete classes? suppose following scenarios: 1) public interface abstype1 { public boolean method1(int a); // it's ok, primitive types here } 2) public interface abstype2 { public boolean method2(myclass a); // think have coupling here } should choose different design here in order avoid latter? e.g. public interface myinterface {} // yes, empty public classe myclass implements myinterface { // identical previous "myclass" } public interface abstype2 { public boolean method2(myinterface a); // better (as long // interface stable) } but there's still doesn't convince me... feel uncomfortable declaring empty interface, though saw else doing so. maybe , abstract class work better here? i little bit confused. edit: ok, i'll try more specific making example. let...

json - Load date from store to combobox -

hello server date store "url: /book/price" . , response comes server { status: "success", msg: "операция завершена успешно", data: [ "500", "600" ] } this information "data" want insert in combobox. create store, don't know write there: store: ext.define('tpl.store.price.book', { extend: 'ext.data.basestore', autoload: true, proxy: { type: 'ajax', url: '/book/price', reader: { type: 'json', root: 'data', successproperty: 'success' } }}); and in combobox don't know write in valuefield { xtype: 'combobox', width: 350, store: 'price.book', valuefield: '???' } thanks answers your proxy should be: proxy: { type: 'ajax', url: '/book/price', reader: { type: 'json...

how to solve this mean stack application error -

i designing application using steps given in link i want place static html pages in project using mean stack, when compiling code, getting following error, referenceerror: myapp not defined @ c:\documents , settings\ssit\my documents\github\ssit\server\routes\index.js:11:6 @ callbacks (c:\documents , settings\ssit\my documents\github\ssit\node_modules\express\lib\router\index.js:164:37) @ param (c:\documents , settings\ssit\my documents\github\ssit\node_modules\express\lib\router\index.js:138:11) @ pass (c:\documents , settings\ssit\my documents\github\ssit\node_modules\express\lib\router\index.js:145:5) @ router._dispatch (c:\documents , settings\ssit\my documents\github\ssit\node_modules\express\lib\router\index.js:173:5) @ object.router (c:\documents , settings\ssit\my documents\github\ssit\node_modules\express\lib\router\index.js:33:10) @ next (c:\documents , settings\ssit\my documents\github\ssit\node_modules\express\node_modules\connect\lib\proto.js:193:15) @ obj...

android - How to communicate between FragmentTabHost and Activity? -

i have fragment add activity. in fragment, declare fragmenttabhost tabspec. how can communicate between tabspec , activity? tab host means in using fragment na, asking how communicate between fragment , activity.? create interface , create abstract method in it. extends activity interface , implement method.and in fragment call abstract method , write code. if have still doubts refer example. android communication between activity , fragment hope helps

Lighweight tool to monitor elasticsearch cluster -

i using elastic search 90.02 version , looking tool can give me simple metrics cluster health check, memory, os stats described here over time can accumulate them , fine tune elasticsearch performance. list of tools mentioned here @ elasticsearch docs exact use case metrics on remote machine on time. not want fancy ui's accumulative data on time simple ui. can please suggest experience? the list of elasticsearch plugins within docs comprehensive one. have used first 4 plugins mentioned, , each have own pro's , con's. believe marvel , tool written elasticsearch developers, fulfil requirements of viewing cluster state on time. depending on activity on cluster can utilise lot of disk space. marvel has fantastic ui, may not fulfil requirements simplistic. free use outside of production, not in production, may deal breaker use case. otherwise, aware of no other options. perhaps custom application carry these task out may appeal more, periodically collecting data...

c++builder - Linker is unable to open COMCTRLS.OBJ -

i'm trying rebuild c++ builder project rad studio xe xe5 . rather big project i'm struggling since week (updating / modifying several delphi components etc.) so. what not fix linker error telling me comctrls.obj can't opened. have seen recommendation make new project file instead of upgrading in answer similar question did (this costed me half day), nothing has been changed. any idea how solve issue? problem solved - please see @ https://forums.embarcadero.com/message.jspa?messageid=648072#648072 make sure don't have old .obj/.dcu/.lib files being carried on earlier xe compilation xe5 environment. double-check project , ide search paths make sure old xe paths not being referenced xe5. i had old lib file delphi package created xe referenced accident instead of new lib created xe5 although i've installed xe5 on different pc no embarcadero on before (working 2 versions on same pc more or less impossible - hav...

asp.net - IP address accessing protected folder -

is possible unallowed ip address access protected area using "ipv4 address , domain restriction" ? i have protected subdomain on server allow few ip addresses access , alert me through email after every successful visit, got email alerting me unlisted ip address have visited protected folder.is possible? it depends on how ip address of client. example if 1 of client come behind proxy or load balancer, client's requets contain x-forwarded-for in http header. if asp.net codes gets information instead of real ip address can lead bypass ip protection. in order sure impact application must sure way of grabbing ip address of user. you see details of trying explain. how pass http_x_forwarded_for aspx pages iis in conclusion, frameworks or method can return x-forwarded-for or similar header variables instead of real ip address. need sure these mechanism.

Setting an image from ios OR Android app as Facebook Profile Picture (Using Facebook API) -

this question has answer here: how set facebook profile picture using graph api 3 answers can set image ios or android app facebook profile picture.using facebook api if possible how? regards facebook doesn't appear provide api change profile picture. try replicate web apps doing: upload image , try guide user tap "make profile picture" button (by showing uiwebview , pointing relevant page). see question (not ios or android specific): how set facebook profile picture using graph api

node.js - less css and and node js troubles -

when try install less css compiler under ubuntu 13.10 box following message , lescss don't working. in way can fix problem? execute: sudo npm install -g less after e list ok messages: npm http 304 https://registry.npmjs.org/cryptiles npm http 304 https://registry.npmjs.org/ctype/0.5.2 npm http 304 https://registry.npmjs.org/combined-stream npm http https://registry.npmjs.org/delayed-stream/0.0.5 npm http 304 https://registry.npmjs.org/sntp npm http 304 https://registry.npmjs.org/boom npm http 304 https://registry.npmjs.org/delayed-stream/0.0.5 and list finished following: /usr/local/bin/lessc -> /usr/local/lib/node_modules/less/bin/lessc less@1.7.0 /usr/local/lib/node_modules/less ├── mime@1.2.11 ├── mkdirp@0.3.5 ├── source-map@0.1.33 (amdefine@0.1.0) ├── clean-css@2.1.8 (commander@2.1.0) └── request@2.34.0 (json-stringify-safe@5.0.0, forever-agent@0.5.2, aws-sign2@0.5.0, qs@0.6.6, tunnel-agent@0.3.0, oauth-sign@0.3.0, node-uuid@1.4.1, toug...

How to call ceil function in c++ from my classes's ceil function -

i need delegate 'ceil' function. class has method 'ceil', need return cpp's native method 'ceil'. how call it? double ceil() { return ceil(); } - recursion double ceil() { return ::ceil(something); // ceil has argument } of course, above when define method inside class definition; following when define method outside class: double myclass::ceil() { return ::ceil(something); } and comment suggests, using std::ceil included <cmath> better, because indeed, ::ceil not guaranteed ceil c library.

spring - LazyInitializationException in AOP logger aspect -

i have app build spring, jsf jpa , hibernate. have aspect "watches" every update*, create*,delete* method service layer of application. aspect logs method params, apply tostring every param , them log them in database. problem use domain objects in jsf , when try update* lazyinitializationexception when tostring() applied method param. 1 solution remove tostring params represents other objects operation has no sense not log details interests me. ie. have entity called price has dependency pricelist: public class price extends baseentity implements serializable { private static final long serialversionuid = 1l; @column(name = "price") private double price; //bi-directional many-to-one association telcopricelist @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "price_list_id") private pricelist pricelist; ..................... } and price used addpriceform.xhtml, jsf form. jsf addpricemb has reference priceservi...

TCL. How to check if procedure exists? -

i need check if procedure func1 exists , result (if exists 1 if not 0 ) put in variable proc_ststus_var . how can it? info procs ?pattern? give basic building block want: % proc foo {} {} % info procs foo foo % info procs bar % something like: % proc procexists p { return uplevel 1 [expr {[llength [info procs $p]] > 0}] } % procexists foo 1 % procexists bar 0

C-Void pointer inside a generic list (Contains stucture) -

i have 2 different stuctures need contain them in same generic list. the structures : typedef struct val1{ int num1; int num2; int num3; }val1; typedef struct val2{ char name[50]; char surname[50]; int id; }val2; and list is: typedef stuct list { void *value; struct node *next; }list; typedef struct l_head{ node *head; int num_members; }l_head; i need use same list implementation list needs handle both of strucrure types.i cant figure out how initialize list , put elements in list .any advice helpfull. the canonical solution c add common initial field having distinct values both structures. typedef struct val1 { int discriminator; int num1; int num2; int num3; } val1; typedef struct val2 { int discriminator; char name[50]; char surname[50]; int id; } val2; if neccessary, can define new struct instead. has advantage of preserving previous layout , alignment gua...

javascript - AJAX - Set-Cookie not working for same domain but different path -

the browser doesn't allow me this: 1) load http://localhost:8080/myapp/page1 -> sets jsessionid cookie path=/myapp , domain=localhost 2) through ajax request call http://localhost:3000/login?user=xxx -> in response, both in chrome & firebug, see: set-cookie: connect.sid =xxxxxxyyyyyy path=/ domain=localhost i expecting when performed ajax call, instance http://localhost:3000/anothercall (still staying in http://localhost:8080/myapp/page1 ), browser send cookie connect.sid in headers. however, doesn't!! any idea why? both cookies belong same domain, difference path there shouldn't cross domain issues. additionaly have tried setting headers in nodejs response. same result: res.header('access-control-allow-origin', "*"); res.header('access-control-allow-methods', 'get,put,post,delete,options'); res.header('access-control-allow-headers', 'cookie, content-type, authorization, content-length, x-requeste...

lua - Scaling in gideros -

local scaling = application.center application:setscalemode(scaling) i tried using above code in gideros gives error 'bad argument #1 'setscalemode' (string expected, got nil) @ setscalemode, how can fix ?actually, did not recognise application.center , though according apress lua game development, should. it seems constants not set (probably bug), can still use values here: http://docs.giderosmobile.com/reference/gideros/application/setscalemode#application:setscalemode as application:setscalemode("center") but can set value in gideros studio project properties

facebook - Get shares from a post -

i have post_id . i'm trying retrieve shares count of post. the post published app, in status_type of post have app_created_story . i'm using: get /post_id/shares have response, nothing, if know post been shared. i notice if don't have app_created_story shares parameter work correctly. anyone knows problem? bug? thank all! you should able retrieve via get /{post_id}/sharedposts edge. see documentation here https://developers.facebook.com/docs/graph-api/reference/post/#edges https://developers.facebook.com/docs/graph-api/reference/object/sharedposts

php - Volusion API generic product export, product image missing -

i using vollusion api product information, using below url export data. http://www.example.com/net/webservice.aspx?login=mylogin&encryptedpassword=mypaasword&edi_name=generic \products&select_columns=*,pe.photourl_large,pe.photourl_small,pe.photourl_large. this url exports other product information xml file, not product image. plzzz if 1 know it. the reason why there no image data returned because not have url data inserted photourl_small and/or photourl_large field in admin area of store products. photourl_small and/or photourl_large fields populated data in these fields. there no built in volusion method have image url's appear within xml output admin generated api call. there way return image url in xml output requires different api approach , has nothing built in volusion api admin page, of beyond scope of question @ hand. edit why not run simple sql query admin section? home > inventory > import / export assuming "2t" im...

Jquery get seventh element in dom -

i trying 7th element in dom: $('.liabilityblock'+[7]+' .large-3:last').append(createbuttons()); but doesn't work. can do? thanks! try :eq() selector select nth element $('.liabilityblock:eq('+ 6 +') .large-3:last').append(createbuttons()); as @j08691 pointed out correctly, can use $('.liabilityblock:eq(6) .large-3:last').append(createbuttons()); if want select 7th element.

magnetic cards - Amex track data format -

i having troubles track data processing: it appear various amex cards labelled ‘ansi’ cards within various amex test cases not contain service code. there no indication service code not contained in track data (this includes no separators etc). how determine no service code contained in track , avoid incorrectly using discretionary data service code instead? example: standard track: 374245455400001=131210112011234500000 – service code 101 track no service code: 374245455400001=1412120112345 - in case 120 incorrectly interpreted service code whereas forms part of discretionary data. thanks. i have specification 2 types of amex cards:- ansi field name length start sentinel 1 account number (pan) 15 field separator 1 ‘=’ expiration date (yymm) 4 effective date (yymm) 4 discretionary data 5 end sentinel 1 lrc 1 total: 32 iso field name length start sen...

angularjs e2e - How can I add URL's dynamically to Protractor tests? -

i trying use protractor in conjunction jenkins. in jenkins, need have urls dynamically generated. so while running protractor tests, example: describe('angularjs homepage', function() { it('should greet named user', function() { // load angularjs homepage. browser.get('http://www.angularjs.org'); element(by.model('yourname')).sendkeys('testuser'); }); }); in above example want pass variable dynamically in place of " http://www.angularjs.org ". i not find variables can specified in reference config well. if understand question correctly, looking environmental variable configure base url. in case, since protractor built on webdriver should able set webdriver.base.url="http://someurl" hopefully looking for.

How to translate query from SQL to MongoDB C# Driver: Like, Distinct and Top -

my sql query looks like: from attr in attributes attr.value.contains("444") select attr.value).distinct().take(100).tolist(); i have tried dont know use "setlimit(n)" function here: imongoquery likevaluequery = query.matches("value", "/444/"); var result = attributes.distinct("value", likevaluequery); regards.

Regex cut number in a string c# -

i have string following 2 - 5 want number 5 regex c# (i'm new regex), suggest me idea? you can use string.split method simply: int number = int.parse("2 - 5".split('-', ' ').last()); this work if there no space after last number.if case then: int number = int.parse("2 - 5 ".split('-', ' ') .last(x => x.any() && x.all(char.isdigit)));

sql - Hiding inside group columns from other columns that don't have values -

0down votefavorite i'm working on report , person needs presented in specific way. i'm not sure how columns outside displaying dates next column inside matrix displaying values. for example setup this: | hireddt | termdt | [type] | licdt | meddt | --------------------------------------------------------------------------------- id | [hireddt] | [termdt] | sum([count_of_type]) | [licdt] | [meddt] | --------------------------------------------------------------------------------- and looks this: | hireddt | termdt | lic | med | app | licdt | meddt | ---------------------------------------------------------------------------------------- 1 | 1/31/12 | 1/31/14 | 1 | 1 | 12 | 6/1/15 | 9/1/14 | 2 | 2/19/12 | 9/18/14 | 1 | 1 | 12 | 3/2/15 | 9/1/14 | but when use inside grouping match date next associated document type get:...

java - First line in gzip file is not correct -

i using gzipinputstream read gzip file. gzip file contain 1 text file. i using following code read gzip files line line inputstream filestream = new fileinputstream("file"); gzipinputstream gzipstream = new gzipinputstream(filestream); reader decoder = new inputstreamreader(gzipstream); bufferedreader reader = new bufferedreader(decoder); string line = null; while((line=reader.readline())!=null){ //read line line } i able read lines in original file(uncompressed file) except first line. first line contains meta data , line. this causing issue in parsing line not in format want. how can read first line without data.

How to add a validation that accepts only years above a certain value, Ruby on Rails -

currently have following: validates :year, presence: true however, need validate years later 1960. don't want have manually input of years , have reject years within range. also, years should not valid if greater present year. numericality validator should work here: validates :year, numericality: { greater_than: 1960, less_than_or_equal_to: -> { date.current.year } }

c# - Exclude property from being indexed -

i have created below object mapped elasticsearch type. exclude univid property being indexed: [elastictype(name = "type1")] public class type1 { // ignored public string univid { get; set; } [elasticproperty(name="id")] public int id { get; set; } [elasticproperty(name = "descsearch")] public string descsearch { get; set; } } you should able set optout value of elasticproperty attribute, following: [elasticproperty(optout = true)] public string univid { get; set; }

c++ - Read first n letters from file to a string? -

i'm quite new programming, , i'm doing exercise should use cycle read 25 first symbols file, contains string of 25 letters (+spaces if name shorter 25) , 2 numbers. example: whirlpool machine 324 789.99 as imagine should this: ifstream info("information.txt"); string str; int a; double b; for(int = 0; < 25; i++) { // kind of code first 25 symbols string. } info >> >> b; and can't seem find right code 25 characters straight string. suggestions? an easy way use read() read given number of characters: int length = 25; // num of chars want read str.resize(length, ' '); // reserve spaces char* begin = &*str.begin(); info.read(begin, length); // <- read here

php - How to group rows and list a certain columns values -

i have table has rows of dates & times . want produce list of times each unique date in table . here table: date time 2000-01-01 09:00:00 2000-01-01 13:00:00 2000-07-18 09:00:00 2000-07-18 13:00:00 2000-12-31 10:31:00 2000-12-31 14:17:00 2000-12-31 21:42:00 i result set this: 2000-01-01, 09:00:00, 13:00:00 2000-07-18, 09:00:00, 13:00:00 2000-12-31, 10:31:00, 14:17:00, 21:42:00 is possible? amended: possible produce result set in 1 query? 2000-01-01, 2000-07-18, 09:00:00, 13:00:00 2000-12-31, 10:31:00, 14:17:00, 21:42:00 select date, group_concat(time) times yourtable group date

html - Center elements within an image -

i have tried solutions in here , here , here , many other sources can't seem want. i'm using kickstart template , want have image , text/elements centered (horizontally , vertically) on it. have: <div class="grid"> <div class="col_12" style="margin-top:50px;" > <div class="mainimage"> <h2>h2 text</h2> <h3>h3 text</h3> </div> </div> and css: .mainimage { height:400px; width:100%; background-image: url(img/customers.png); text-decoration:line-through; display: flex; justify-content: center; /* align horizontal */ align-items: center; /* align vertical */ } i have tried display: table-cell; vertical-align: middle; but these don't work. most solutions involve specifying width. not want specify width want page responsive. if use display:table makes background ...

stack overflow - java.lang.StackOverflowError while adding items to list -

trying add items list , print them, compiles, i'm getting run time error theres stack on flow error. error prints out: exception in thread "main" java.lang.stackoverflowerror @ list.<init>(list.java:5) @ list.<init>(list.java:9) @ list.<init>(list.java:9) <----- line repeated quite few times this code methods adding , print list. public class list { private athletenode front; public list(){ front = null; } public list athletes = new list(); //add athlete end of list public void add(athlete a){ athletenode node = new athletenode (a); athletenode current; //temp node iterate on list if(front == null) front = node;//adds first element else{ current = front; while (current.next !=null) current = current.next; current.next=node; } } in class list , have list instance field gets initialized @ declaration public list athletes = new list(); this means every list have list has list has list , ad naus...

java - Connection properties error when starting JBoss as a Maven plugin -

i'm trying install content management system polopoly on pc. following error when run mvn p:run command (this intended start polopoly installation embedded database, jboss , web container): failed execute goal com.polopoly.extensions-maven-plugin:10.6.1-fp1 1-c871a5b:run (default-cli) on project myproject: not deploy com.polopoly. extensions-maven-plugin:import-scan: not scan content: not create content importer: org.apache.maven.plugin.mojoexecutionexception: unable read connection properties. not connection properties 'http://localho st:8081/connection-properties/connection.properties', nor backup 'c:\users\ hollandv\appdata\local\temp\http___localhost_8081_connection-properties_connecti on.properties'. -> the detailed version of error follows: [error] failed execute goal com.polopoly.extensions-maven-plugin:10.6.1-fp1 1-c871a5b:run (default-cli) on project myproject: not deploy com.polopoly. extensions-maven-plugin:import-scan: not scan content: not...

javascript - Redirect to a page if shared from Facebook -

i don't know whether possible. creating site in php. possible detect previous url facebook/twitter, , if yes redirect page? in detail have page , b. there share button in page b. on clicking button post title, image, description etc of page b facebook. clicking in facebook redirect page a. can me? if pages on same domain can use sessions. for external pages can use $_server['http_referrer'] . i.e. if ( $parts = parse_url( $_server['http_referrer'] ) ) { if($parts['host'] == "www.facebook.com"){ //do } }

sqlite - Python's sqlite3 module not consolidating my database changes -

attempting populate database latlon weather data future consultation. doing via sqlite3 python module. at moment, able create table (a resulting .db file visible after program execution). able consult rows after insertion, i'm sure cursor.execute lines working. unfortunately, after program execution, upon consulting database "select * table" statement, nothing appears (even though same command worked beforehand, while program executed). in fact, when dumping sqlite3 file, create statement. what wrong? no errors or warnings. the code itself: #!/usr/bin/python import sys import numpy netcdf4 import dataset import sqlite3 # config variables. n = 0 e = -30 s = -30 w = -60 ncfile = sys.argv[1]; ncdata = dataset(ncfile,'r',format='netcdf4') sst = ncdata.variables['sea_surface_temperature'] lat = ncdata.variables['lat'] lon = ncdata.variables['lon'] # data reshaping. lat = lat[:] lon = lon[:] sst = sst[:] c_lat = nu...

php - regex to match div tags -

i'm using regex match specific div's in page , replace them custom formatted one. can't use domdocument pages process mal-formed , after running through domdocument, pages reformatted , don't display same. i'm using following works perfectly: preg_match('#(\<div id=[\'|"]'.$key.'[\'|"](.*?)\>)(.*?)\<\/div\>#s', $contents, $response); to match div tags such as: <div id="test"></div> <div id="test" style="width: 300px; height: 200px;"></div> etc... the problem i'm encountering tags id after style or class, example: <div class="test" id="test"></div> if run following, regex seems become greedy , matches ton of html before div tag, i'm not sure how fix this: preg_match('#(\<div(.*?)id=[\'|"]'.$key.'[\'|"](.*?)\>)(.*?)\<\/div\>#s', $contents, $response); does have id...

jquery - Cross tab variable in javascript without server interaction -

i developing chat system , got question ask you. i dont think possible since see similar behaviour in websites, know how access variable defined/modified in other tab? mean don't want send server. how var myvalue=getvalueinavailabletab(varname); if not possible, how facebook know if chat dialog has been closed in tab? post event on server , retrieve it? i sorry not stealing behaviours best example explain want do. in circumstances, answer question cannot access javascript variable in tab. there other ways pass data between tabs, however: you may create browser extension has functionality want. though different browser frameworks have different limitations upon accessing code of pages open. if windows guaranteed opened same parent window, may use window.parent or window.opener if both tabs same origin site, may have 1 tab store value in cookie, , have other tab retrieve value. these ways in may accomplish need without server interaction. i'm not s...

typescript - What does the "=> any" signify? -

in answer this question s/he refers to: getjson(url: string, success?: (data: any, textstatus: string, jqxhr: jqueryxhr) => any): jqueryxhr; i understand "success?: (data: any, textstatus: string, jqxhr: jqueryxhr)" part - that's saying there optional function called on success has 3 typed parameters. but "=> any" signify in this? mean function can return type of object? doesn't make sense success function logically of type void. thanks - dave you correct; void correct way type function's return value. in practice, there isn't difference between any , void return types in callback positions because compiler not enforce functions type of any have return statement.

javascript - Metro UI FluentMenu -

i want populate metro ui fluentmenu dropdown (see class="fluent-big-button dropdown-toggle") http://metroui.org.ua/fluent-menu.html via ajax servercall. after inserting received elements dom dropdown doesn't appear, elements correctly located in dom. i think need additional initialization after loading new elements have no idea how this. after inspecting library saw, fluentmenu realized jquery-widget ( https://learn.jquery.com/jquery-ui/widget-factory/how-to-use-the-widget-factory/ ) - can "re-initialize" these plugins (the first time seems after page load completion)? thanks regards, phil the problem can fixed calling: $("[data-role=dropdown]").dropdown();

Android Compression/Decompression Native Libraries -

does android have built in libraries compression/decompression (besides zlib)? any appreciated. thanks. the java.util.zip package job ( http://developer.android.com/reference/java/util/zip/package-summary.html )

sql server - Concatenate and format text in SQL -

i need concatenate city , state , country columns city, state, country. this code: select city + ', ' + state + ', ' + country outputtext places however, because city , state allow null (or empty) value, happen is, (for example) if city null/empty, output , iowa, usa ; or state empty, output seattle, , usa is there anyway can format output , remove "unnecessary" commas? edited: because of requirements, should not use other mean (such pl/sql, store procedure) etc., has plain sql statement select isnull(city, '') + case when isnull(city, '') != '' ', ' else '' end + isnull(state, '') + case when isnull(state, '') != '' ', ' else '' end + isnull(country, '') outputtext places

php - Laravel 4 Eager Loading n+1 issue -

i have troubleshoot day eager loading/n+1 issue, researched , read , watched tutorials issue, haven't solved yet. have set relationships models, when passing in data helper function got n+1 issue. want grab artist name url site.com/artist/songs , songs , display url this. site.com/$artist/songs/$id my artists/index.blade.php view looks http://i61.tinypic.com/2nqzatk.jpg i'm not sure i'm missing here. thanks in advance! my tables songs id, title, body, slug, hits, artist_id, created_at, updated_at artists id, name, body, created_at, updated_at routes.php event::listen('illuminate.query', function($query) { var_dump($query); }); ... route::get('{artist}/songs', 'artistscontroller@index'); route::get('{artist}/songs/{id}', ['as' => 'artist.songs.show', 'uses' => 'artistscontroller@show']); model: song.php class song extends eloquent { protected $guarded = ['id...

nginx - How to deploy rails sqlite3 database with capistrano -

i trying deploy this: bundle exec cap deploy:cold rails_env=production rake db:migrate bundle exec cap deploy:migrate but time shows error in log file: i, [2014-04-14t14:15:14.853543 #10769] info -- : started "/users/sign_up" 176.192.228.14 @ 2014-04-14 14:15:14 -0400 i, [2014-04-14t14:15:14.856055 #10769] info -- : processing devise::registrationscontroller#new html i, [2014-04-14t14:15:14.857398 #10769] info -- : completed 500 internal server error in 1ms f, [2014-04-14t14:15:14.860844 #10769] fatal -- : activerecord::statementinvalid (could not find table 'users') but in current/db folder created production.sqlite3 . in localhost:3000 works fine. how can migrate db production capistrano? i use nginx , unicorn , repo https://github.com/egorkze/bh working sqlite in production problematic because each time deploy new version entiredb stay on old release folder, can when deploy add command: task :copy_sqlite, roles: :app run...

Change a boolean back and forth javascript -

i wonder if possible in javascript have click event listener every time click changes boolean true false , forth. meaning click 1 goes false, click again , goes true , on in infinite loop. don't know if possible tried this: //this listener circlepicker.click(function () { booleanchecker(circlepickerselector); console.log(booleanchecker(circlepickerselector)); }); //this function checks if boolean true or false function booleanchecker(isthistrue) { // circlepickerselector = !circlepickerselector; // return circlepickerselector; if (isthistrue == false) { isthistrue = true; console.log("i turned true"); } else if (isthistrue == true) { isthistrue = false; console.log("i turned false"); } return isthistrue; } i know if possible. feeling wrong in syntax. suggestion more welcome. thanks! you can toggle using ! operator circlepicker.click(function () { circlepickerselector = !ci...

javascript - Giving ID to dynamically created button in jQuery -

i'm trying create set of buttons using jquery , give them id's, when try reference id's later, doesn't seem work. can fix it? for(i=0;i<7;i++) { $("h2") .append('<input type="button" value="display answer">') .button() .attr("id", i); }; $("button").click(function() { if($(this).attr("id") === "all") { for(i=0;i<answerarr.length+1;i++){ $("#p" + i).text(answerarr[i-1]); } } else { $("#p" + $(this).attr("id")).text(answerarr[$(this).attr("id")-1]); } }); .append() returns element called on, not newly appended element. adding id (and calling .button() ) on <h2> element(s). try using .appendto() instead, , adding id when create element: $('<input/>', { type: 'button', id: i, value: 'display answer' }).appendt...

arrays - Playing with Hashes from a FTP flow in Perl -

ok, i'm having issues understanding how work hashes. long story short, i'm attempting parse through ftp log , find relevant flows specific search criteria. i'm trying make is, have ip address or user name, first pretty simple grep try minimize data don't need , send output external file. if i'm searching username testing1, grep on testing1 , sends output file called output.txt: dec 2 00:14:09 ftp1 ftpd[743]: user testing1 dec 2 00:14:09 ftp1 ftpd[743]: ftp login 192.168.0.2 [192.168.0.2], testing1 dec 2 00:30:08 ftp1 ftpd[1261]: user testing1 dec 2 00:30:09 ftp1 ftpd[1261]: ftp login 192.168.0.4 [192.168.0.4], testing1 dec 2 01:12:33 ftp1 ftpd[11804]: user testing1 dec 2 01:12:33 ftp1 ftpd[11804]: ftp login 192.168.0.2 [192.168.0.2], testing1 and below example of originating log data: dec 1 23:59:03 ftp1 ftpd[4152]: user testing1 dec 1 23:59:03 ftp1 ftpd[4152]: pass password dec 1 23:59:03 ftp1 ftpd[4152]: ftp login 192.168.0.02 [192.168.0.2]...