Posts

Showing posts from April, 2015

mysql - Select a particular type of columns that begin with a certain letter and fetch data all together -

i trying fetch data @ same time select specific type of columns i`m doing is: select column_name information_schema.columns table_name = 'table' , table_schema = 'db' , column_name 'f%' this query give me col names, there option fetch data of colum @ same time? or need take array of cols , make query? let want fetch data, doesnt matter. thanks. you can use stored procedure this, dynamic sql. first, must create stored procedure: create procedure fetchcolumns (in pschemaname char(50), in ptablename char(50), in pcolumnlikecondition char(50)) begin declare v_cols char(200); select group_concat(column_name separator ' , ') v_cols information_schema.columns table_name = ptablename , table_schema = pschemaname , column_name pcolumnlikecondition; set @s = concat('select ',v_cols,' ',ptablename ); prepare stmt @s; execute stmt; end and finally, have calling it, this...

c - Why are there few compilers that comply with C99? -

it's on ten years since c99 published. however, far there have been few, if any, compilers have support new features of c99. why? btw: there compilers comply c99? according wikipedia: c99 implementations , popular compilers (except visual studio) have support not c99 features(like gcc or clang), but, yes, compilers have comply c99. i think 1 of reasons of c99 features not useful compiler vendors. newest standard, c11, on other hand, allows implementations not support parts of standard — including had been mandatory support in c99, complex types , variable length arrays. (see c11 §6.10.8.3 conditional feature macros )

How to import .C & .pl extension exploits into metasploit framework? -

how can import .c(c language) , .pl(perl) extension module exploits metasploit framework? metasploit accept .rb (ruby) extension modules? can provide tutorials import these extension modules? read immunity debugger, don't understand way convert it. immunity debugger used code exploits. i want import below shellcode in metasploit framework.this code written in c language. there way import below exploit metasploit framework. http://www.exploit-db.com/exploits/1/ there no sofware or tool can convert exploit c/c++ or others metasploit framework, it's easy , can learning essentials of ruby. take note of important values exploit , put values in metasploit's exploit frame. values such return address, eip , buffer size required, no need include payload.

c# - Why would an event be null? (object reference not set to an instance of an object) -

i have form button, label , progress bar, when click button creates instance of class b run process. once process done call eventhandler show "done" in main form's label! i created event (setstatusevent) of delegate (setstatus) this. , seems fine when call event outside eventhandler (usbforprocessexited) when call usbforprocessexited gives error - object reference not set instance of object main form public partial class main : form { b rsset = new b(); public main() { initializecomponent(); rsset.setstatusevent += new remotes.setstatus(updatestatus); } private void button1_click(object sender, eventargs e) { rsset.formatusb(); } private delegate void updatestatus(int i, string str, color clr); private void setstatus(int i, string str, color clr) { this.progressbar1.value = i; this.lbl_status.forecolor = clr; this.lbl_status.text = str; } private void updatesta...

html - 100% height for body and its child elements -

Image
i specifying background color body displays distance only. need full height , child elements too. 1 of child elements has border-right needs show on full screen height. my css looks like(sample one) better check demo demo page html,body { height: 100%; background-color: #fefefe; } .cover { height: 100%; } .left_side { float: left; height: 100%; border-left: 1px solid #ccc; width: 31%; } and html is <body> <div class="cover"> <div class="left_side"> </div> </div> </body> and bgcolor , childs border seems up-to limited distance problem guys need background , border 100% height. remove height:100% body , html style. instead of having border set left container, try setting border on content container instead. your css like: .large-9 .columns .right_side...

Excel VBA Dim a new -

i'm new vba coding , i'm getting hung how navigate between sheets. have workbook contains single sheet , sheet copied new workbook can edited without damaging origianl. issue i'm having when new work book created need copy informaton 3rd workbook , paste new one. i've tried number of things haven't been able figure out. think issue new book doesn't have name book# once leave activate other book don't have solid path back. sorry lack of actual example. have added first 2 lines based on response received. dim wb workbook set wb = activeworkbook ' open 3rd workbook & copy workbooks.open ("z:\terms , conditions.xlsx") windows("terms , conditions.xlsx").activate activesheet.shapes.range(array("picture 4")).select selection.copy ' return wb , paste activeworkbook(wb).activate 'the code stopping here worksheets("sheet1").activate range("a534")...

ios - Why does reloadRowsAtIndexPaths doesn't reload a cell's UILabel alpha value, but reloadData does? -

when select row, method gets called: - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { [_historyentrytableview reloadrowsatindexpaths:[nsarray arraywithobject:indexpath] withrowanimation:uitableviewrowanimationfade]; } and cellforrowatindexpath, i'm dynamically setting alpha value uilabel. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cell = @"standardcell"; twhistoryviewstandardcell *cell = (twhistoryviewstandardcell *)[tableview dequeuereusablecellwithidentifier:cell]; if (cell == nil) { cell = (twhistoryviewstandardcell *)[[[nsbundle mainbundle] loadnibnamed:@"historyviewstandardcell" owner:self options:nil] objectatindex:0]; } //... if (currentpick == pickdatefrom) { cell.hourslabel.alpha = 1.0; } else { cell.hourslabel.alpha = 0.7;...

asp.net mvc - Subsequent Methods Dependent on 'primary method' result -

this structure question of code bit unsure of how proceed bearing in mind performance. in application have method has run on every request goes db , gets values based on url, before else can happen (think cms re need know site being looked at). i have done in 'basecontroller' on initialize other controllers inheriting , seemed work fine. i.e. put result in public variable , able access in actionresult or whatever neeeded. key was called once per page request. now kind of fundamentally changing structure more 'widget' style. every widget need data, , there anywhere 1 ... alot of widgets on page. when each widget's model don't want hit db every time same info before getting 'actual' data widget. so should 'data' once pre loop , feed method calls each widget .... or case type of dependency injection can help? (i bit 'green' in area :p ) it's don't want write each widgets method e.g. public list<string> widge...

javascript - jquery fileupload plugin, how to cancel upload file process -

i want cancel click event of file upload if condition true, like $('.fileupload').fileupload({ url: url, datatype: 'json', start: function (e, data) { //how acheive this? if(some condition 1){ alert('you can upload file'; //show file browser window , upload file normal } else{ alert('you cannot upload file'); //do not show file selection window , not upload file } } }); i using https://github.com/blueimp/jquery-file-upload/wiki/options

angularjs - Global variables in JavaScript strict mode -

a simple javascript question, instance have angular app.js this; 'use strict'; var eventsapp = angular.module('eventsapp',[]); i read using "use strict" in beginning of javascript file makes vars in file treated in strict mode, means throw error when use global variable(?), how can access "eventapp" object our controllers , services if that's not in global scope? the faulty assumption in strict mode all global variables disallowed. undefined global variables throw error. (in fact couldn't @ if couldn't use any global variables. there has @ least in global scope.) for example: "use strict"; var = "foo"; var b; (function() { = "bar"; // ok, initialized earlier b = "baz"; // ok, defined earlier c = "qux"; // not, creating implicit global })(); using variables a or b not problem, c throw error. there should no problems using eventapp variable in...

c# - encoding mp3 or other music files -

a bit of background: summer, set myself programming project, want make e-jay clone(a program simple drag-drop blocks little bits of music , beat make track) dont know start on whole encoding music bit. example: how sound file work? how transform piece of sound file universal piece of sound information how create sound file scratch how add pieces of sound newly created sound file im sorry if seem 1 of guys cant use google n stuff. have no experience sound or on part. programming language: c# ultimate goal: able encode new mp3 file using small sound files inserted on points in file ultimatly make music any appreciated, thank reading question. i think should check naudio site - has lots of examples.

How to write session timeout in asp.net -

i new asp.net..please me write code setting session timeout , how implement in pages,i tried out using web config method,but not getting,i nearing deadline. code from code: session.timeout = 60; // set 60 min timout from config: <sessionstate timeout="60" />

audio - How to generate complex sound on Android? -

i need generate complex sound few frequences (superposition) on android in real-time. how can using android sdk (preferred) or ndk? it seems using tonegenerator not flexible enough. recording audiotrack generated sound data , playing seems right direction, need in real-time , recording , playing seems not real-time. an example book "pro android media" shawn van every: import android.app.activity; import android.media.audioformat; import android.media.audiomanager; import android.media.audiotrack; import android.os.asynctask; import android.os.bundle; import android.util.log; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; public class audiosynthesis extends activity implements onclicklistener { button startsound; button endsound; audiosynthesistask audiosynth; boolean keepgoing = false; float synth_frequency = 440; // 440 hz, middle @override public void oncreate(bundle savedinstancestate) { su...

python 3.x - Start a shell program in it's own process -

on linux need start number of socat instances within python 3 program. appears os.exec functions assume program specified in exec replace executing python. it appears there ways start things subprocesses presumably subprocesses die when invoking python program ends. how start several tasks persist after python program finishes it's work without having python process replaced?

javascript - How to add event handler to route displayed event in Ember.js? -

i have simple site in ember.js has this: app.router.map(function() { this.resource('main', { path: '/main' }); this.route('sub', { path: '/sub' }); and template this: <script type="text/x-handlebars" data-template-name="main/sub"> <a href='image.jpg' class='fancybox'><img src='image.jpg'></a> </script> now in order make fancybox when click on image opens in new layer call function: $("a.fancybox").fancybox(); now need call when main/sub displayed. , must done after template main/sub displayed. so how bind event template being displayed in order call fancybox? one possible way creating mainsubview , hook didinsertelement function: app.mainsubview = ember.view.extend({ didinsertelement: function() { $("a.fancybox").fancybox(); } }); the didinsertelement function called when view inserted dom. also worth m...

delphi - iOS simulator somehow broken with rotation and controls placement -

Image
when decide ios simulator should show normal iphone, odd happens. if e.g. ipad placed landscape left right, places content layout wrong. happens in own ios before apps run. see screenshots: tried reset content , settings , still no luck:

html - Vertically align Text to middle of an image -

Image
i've got list couple of list items containing text. i'm adding image each list item using :before pseudo. image noticeably bigger text, how can align text or image in middle? thank you - what see what want achieve html <ul class="stats"> <li class="messages">2</li> <li class="sales">15</li> </ul> css .stats { list-style: none; margin: 0; padding: 0; float: left; } .stats .messages:before { content: url(../images/messages.png); opacity: 0.2; } .stats .sales:before { content: url(../images/basket.png); opacity: 0.2; } add: .stats li { line-height: 22px; } ... 22px height of yours icons.

iphone - Is it possible to get credit card type using card.io? -

i'm using card.io ios sdk credit card scanning. is possible credit card type(ie, whether amercan express or master or visa) using card.io? what other possible details credit card can using card.io? i have no experience of using card.io . question got me curious api. in github, found , in there, there file: cardiocreditcardinfo.h // derived cardnumber. // when provided card.io, cardtype not cardiocreditcardtypeunrecognized or cardiocreditcardtypeambiguous. @property(nonatomic, assign, readonly) cardiocreditcardtype cardtype; hope helps. trying learn this, if doesnot please tell me.

ios - How to reduce the memory size of the image saved in Document Directory? -

i have made iphone app in download images via ftp & saved in document directory. these images of high memory size (approx. 2-3 mb) . then display these images in uitableview many rows & due these images allocation memory big & that's why app crashes . so, need reduce memory size of these images. how can this? thanks, make thumbnail of images before add them uitableview. in way size of images reduce drastically. use following code on uiimages picking document directory . uiimage *originalimage = ...; cgsize destinationsize = ...; uigraphicsbeginimagecontext(destinationsize); [originalimage drawinrect:cgrectmake(0,0,destinationsize.width,destinationsize.height)]; uiimage *newimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); also have @ following links :- thumbnail view of images http://www.icab.de/blog/2010/10/01/scaling-images-and-creating-thumbnails-from-uiviews/ https://gist.github.com/djbriane/160791 ...

sql server 2008 - Mondrian Olap ClassNotFoundException: mondrian.olap4j.MondrianOlap4jDriver -

i have build schema file of mondrian , sql server. now writing code in java database connection using olap4j. code : try { class.forname("mondrian.olap4j.mondrianolap4jdriver"); string connectionstring1 = "type=olap name=sales driver=mondrian.olap4j.mondrianolap4jdriver location=jdbc:mondrian:jdbc=jdbc:sqlserver://servername:1433;database=tempdatabase;catalog=c:/schema1.xml;jdbcdrivers=com.microsoft.sqlserver.jdbc.sqlserverdriver username=sa password=p@ssw0rd"; connection jdbcconnection = drivermanager.getconnection(connectionstring1); olapconnection connection = ((olapwrapper)jdbcconnection).unwrap(olapconnection.class); olapstatement olapstatement = connection.createstatement(); } catch (sqlexception e) { e.printstacktrace(); }catch (classnotfoundexception e) { e.printstacktrace(); } but giving me error while running code : java.lang.classnotfo...

c# - ASP.NET Web API: How to use multiple HttpClientCredentialTypes for authentication in selfhosted szenario -

i have selfhosted asp.net web api server (httpselfhostserver) running under .net 4.0. in httpselfhostconfiguration can set one clientcredentialtype, example httpclientcredentialtype.ntlm. i server accept several credentialtypes, example basic, ntlm , certificate. client should able authenticate of these credentialtypes. is possible?

jQuery delaying a script -

i'm using js make 2 divs same height works fine static content, when images/content being loaded in dynamically height being set 0px because imagine script firing before content has been pulled. there way delay firing few seconds correct height gets set? tried timeout function couldnt work // make stuff same height equalheight = function (container) { var currenttallest = 0, currentrowstart = 0, rowdivs = new array(), $el, topposition = 0; $(container).each(function () { $el = $(this); $($el).height('auto') toppostion = $el.position().top; if (currentrowstart != toppostion) { (currentdiv = 0; currentdiv < rowdivs.length; currentdiv++) { rowdivs[currentdiv].height(currenttallest); } rowdivs.length = 0; // empty array currentrowstart = toppostion; currenttallest = $el.height(); rowdivs.push($el); } else { rowdivs.push($el); currenttallest = (currenttallest < $el....

php - Joomla get article nice URL -

i new joomla , trying develop module under 3.1. managed selected article id , title in module options don't know how url id, similar get_permalink(id) in wordpress. you want run url through jroute full url. need know how joomla articles built. $url = jroute::_('index.php?option=com_content&view=article&id='.$id); this assumes have id in variable $id . rest of url need know component calling (added option above, content manager com_content ) , view (which article article ). can see different views available com_content checking file structure under /components/com_content/views/ . besides article , should see articles , categories , , category few other.

javascript - How to make Ember.js load RESTAdapter data before showing view? -

i have app restadapter takes proper data server: app.afile= ds.model.extend({ name: ds.attr( 'string' ), ... app.store = ds.store.extend({ revision: 13, adapter: ds.restadapter.extend({url: "myapi"}) }); and map this: app.router.map(function() { this.resource('allfiles', { path: '/allfiles' }); this.resource('onefile', {path: '/onefile/:onefile_id' }); and routes defined this: app.allfilesroute = ember.route.extend({ model: function() { return app.afile.find(); } }); app.onefileroute = ember.route.extend({ model : function(params) { return app.afile.find(params.onefile_id); } }); and templates: <script type="text/x-handlebars" data-template-name="allfiles"> {{#each controller}} {{#linkto onefile this}}open{{/linkto}} {{/each}} </script> <script type="text/x-handlebars" data-template-name="onefile"> {{name}} </...

Installing a bower package: "no-json No bower.json file to save to" -

i've added bower package project root. i'm using bower it's easier manage updates each component (one of bower's features). got message after install: no-json no bower.json file save a few things: — there in fact bower.json file w/i component's folder. should there global project bower.json file? — will error mean package not update? — the project wordpress project using "wordpress-starter-theme" (which uses grunt handle compass, etc). grunt interfering? need add gruntfile.js manage bower? thanks in advance. you can run bower init to create json file in current directory. docs

c++ - "Undefined struct" error when creating an object -

i'm working on c++ project links c library. c++ class follows: extern "c" { struct __struct1__; struct __struct2__; struct __struct3__; struct __struct4__; } namespace mynamespace { class myclass : public parent { public: .... private: .... __struct1__* s1; __struct2__* s2; struct __struct3__ s3; struct __struct4__ s4; }; } when creating pointers s1 , s2, ok. objects don't work well. following error generated: error using undefined struct how can create objects s3 , s4? variable: __struct1__ *s1 is of type pointer (to structure, still pointer), compiler knows how memory on stack variable needs. in case of: __struct3__ s3 this variable of type __struct3__, without whole definition compiler not know size.

jquery - Selecting element by a content text -

is there simple way (i mena selector) select element has specific 'content text'?. for example, can have following situation <div> <div class="a">text 1</div> <div class="a">text 2</div> <div class="a">text 3</div> </div> we can like $('div div.a').each(function() { if( ($this).text() == "text 1") { // } }); but there way can like: $('div div.a[text="text 1"]) or $('div div.a').someembededfunction('text 1') ? use contains $('div div.a:contains("text 1")) something take account selector case sensitive. if need case insensitive version, you'll need implement own selector or override existing one.

javascript - CSS3 keyframes - changing animation duration causes "jumps" -

you can see what's happening here http://goo.gl/bbmx6x (it's fiddle, wouldn't allow me post without having c&p code) click on start, wait couple of seconds , press stop.. jumps to(i think) position have been if had lower duration beginning. what i'm trying have spinning , on stop "finish" spin little faster.. that not posible way trying. (and reason guess) you have calculate in javascript way second animation has begin. webkit demo the script is $(document).ready(function() { $(".start").click(function(e) { e.preventdefault(); var elem = document.getelementbyid('idtest'); elem.style["-webkit-animation"] = ""; elem.style["-webkit-animation-delay"] = ""; $("#idtest").removeclass("spin2").addclass("spin"); }); $(".stop").click(function(e) { e.preventdefault(); stopping ...

How can I get erlang crash dump file? -

my program crashes during execution , writes segmentation fault (core dumped) on console. there no generated files in current working directory. question can find generated crash dump file? i'm using ubuntu 13.04 / erlang r15b01 a linux core dump , erlang crash dump not same thing. if you're getting segmentation fault , can't locate core dump, need check os configuration. "cat /proc/sys/kernel/core_pattern" see linux wants write core file, check that directory exists , writable you, , of course check ulimit set produce dump.

system verilog - Copy a packed array to unpacked array -

i wrote code copying packed array unpacked array below: module m1; bit [2:0] temp; bit temp1[2:0]; initial begin temp=3'b011; temp1='{temp}; end endmodule but showing error: "too few assignment pattern items given assignment" solution please. packed array , unpacked array different data structure, cannot directly assigned type. using assignment pattern array must either positional based or index based. example, temp1 = '{temp[2], temp[1], temp[0]}; the solution using streaming operator @ lhs of assignment. {>>{temp1}} = temp;

Heroku PHP mcrypt not found -

yesterday, able push without problems, today, framework ( laravel 4 ) detects there not anymore mcrypt on heroku cedar app. do have information me ? i tryed add php.ini @ root of project with extension_dir = "/app/www/ext/" extension=mcrypt.so and download archive https://s3.amazonaws.com/heroku-buildpack-php-tyler/libmcrypt-2.5.8.tar.gz , took libmcrypt.so.4.4.8 file, renammed mcrypt.so , put in ext folder @ root of application. thanks in advance. here's quick fix: fork official default heroku php build pack (github.com/heroku/heroku-buildpack-php), , revert couple commits (i did here.. https://github.com/jdomonell/heroku-buildpack-php.git ). then set buildpack app (i used own downgraded repo, feel free use too): $ heroku config:add buildpack_url= https://github.com/jdomonell/heroku-buildpack-php.git the issue caused recent update uses php_version="5.3.27" (instead of php_version="5.3.10") ... doesn't seem includ...

bitmap - How to create resizable ImageView in Android -

Image
i want user of app able modify image @ run time. user should able modify image height , width tapping on corner of image-view , dragging illustrated in following diagram: i have spent lot of time researching , found making sense of multitouch , resize large bitmap file scaled output file pinch zoom none of these quite match requirements. currently resizing bitmap using below finction , changing width in onprogress change method of seekbar instead of frame. using function changing image size not working smooth. public static bitmap decodefile(file f,int width,int hight){ try { //decode image size bitmapfactory.options o = new bitmapfactory.options(); o.injustdecodebounds = true; bitmapfactory.decodestream(new fileinputstream(f),null,o); //the new size want scale final int required_width=width; final int required_hight=hight; //find correct scale value. should power of 2. int scale=1; w...

linux - Check if a function exists before executing it in shell -

i want check if function exist or not before executing in shell script. does script shell support that? , how it? as read in this comment , should make it: type -t function_name this returns function if function. test $ type -t f_test $ $ f_test () { echo "hello"; } $ type -t f_test function note type provides informations: $ type -t ls alias $ type -t echo builtin

Getting "OperationalError: 1366" from python script - MySQL 5.6 . MySQLdb 1.2.3 -

environment: mysql-python-1.2.3.win-amd64-py2.7 python-2.7.amd64 mysql-installer-community-5.6.12.2 windows server 2008 r2 datacenter i getting operational error 1366 when inserting data python script. need run epfimporter 2010 i think problem mysqldb can handle uft8 not utf8mb4_unicode_ci . data need import contains utf8mb4 charackters , may not remove them. running script cmd comand line gives me following error message after succesfully inserted ~70.000 rows: 2013-07-31 15:14:53,460 [error]: fatal error encountered while ingesting 'c:\webserver\www\site1\assets\scripts traceback (most recent call last): file "c:\webserver\www\site1\assets\scripts\epfimporter\epfingester.py", line 129, in ingestfull self._populatetable(self.tmptablename, skipkeyviolators=skipkeyviolators) file "c:\webserver\www\site1\assets\scripts\epfimporter\epfingester.py", line 379, in _populatetable cur.execute(exstr) file "c:\windows\python\lib\sit...

javascript - Is there any CallBack function which is called before/after data is loaded in Angular Js ng-Grid? -

Image
presently have angular js grid pagination enabled 5 records per page example , total number of records 2000, there going 400 pages in all. when pagination in ng-grid handled gridoption data specified per page means 1st page gridoption 1-5 rows 2nd 6-10 rows , on........ here have implemented selection functionality through checkboxes whenever row selected[checkbox becomes selected] , it's stored in selecteditems array , show selected items in grid this..... now when move on second page[pagination] , select further rows ... the real trouble lies here when again go previous page i.e page 1 checkboxes not checked because in pagination load data runtime pages shows following result... hope must have understood problem.... what need here callback before/after data loaded can select checkboxes have number of selection preserved or other workaround problem helpful too. thanks!. can store checked value on data model storing row values? come , checked angu...

c++ - How to use Boost headers with Jetbrains Appcode -

Image
i have boost libraries installed on macbook via macports , wondering how configure appcode recognize headers. tried right clicking on project -> add frameworks , libraries -> other... -> browse /opt/local/include -> choose doesn't seem add boost list. has gotten boost work appcode? in case else stumbles upon via google: there 3 steps involved: right click on project , choose add frameworks , libraries , followed other , , browse of dylibs. since installed boost via brew, dylibs located under /usr/local/cellar/boost/1.53.0/lib/ . make sure select of them, under new frameworks folder in navigation window, list of of boost libraries appear. right click on project , choose project settings . scroll search paths , add path boost include directory under header search paths . me located under /usr/local/cellar/boost/1.53.0/include . make sure recursive unchecked, or compile errors if using std!!! proceed add boost lib dir (that browsed in step 1) und...

post - null in FormParam with "charset=UTF-8" in Jersey 2.0 -

i'm working on angularjs project , i'm calling rest services using content-type "application/x-www-form-urlencoded;". on server side use jersey in version 2.0. maven dependency. <dependency> <groupid>org.glassfish.jersey.containers</groupid> <artifactid>jersey-container-servlet-core</artifactid> <version>2.0</version> </dependency> everthing work fine on chrome , ie7. problem firefox add mystically "charset=utf-8" in content type. i made test , if use postman , set "application/x-www-form-urlencoded; charset=utf-8" in content type, jersey has null in formparam parameters this header of method in java @post @produces(mediatype.application_json) @path("movements/") public response movements( @formparam("compte_no") string compte_no, @formparam("compte_bidule") string compte_bidule, @formparam("comp...

java - How to use selenium webdriver on local (on my pc) webpage instead of locate somwhere on www? -

i have use selenium webdriver on webpage have on hard disc. i've tried like: selenium = new webdriverbackedselenium(driver, "c:\\...dispatcher.html"); instead of normal: selenium = new webdriverbackedselenium(driver, "http://www.dunnowhattodo.org"); but don't work (i error "unknown protocol: c") is possible? im kinda new user of selenium webdriver can silly question, still appriciate every get:) try using method: webdriver.get("file:///d:/folder/abcd.html"); (or) selenium = new webdriverbackedselenium(driver, "file:///d:/folder/abcd.html");

java - What significance does `...` serve following a parameter type? -

this question has answer here: java, 3 dots in parameters 8 answers i trying asynctasks working in android, , have found have never seen before on , on again in many different tutorials. certain methods in tutorials passed parameters string... arg0 , integer... values . here tutorial code shown similar describing. what mean? why ... there? it called varargs. works type long it's last argument in signature. basically, number of parameters put array. not mean equivalent array. a method looks like: void foo(int bar, socket baz...) will have array of socket (in example) called baz. so, if call foo(32, ssock.accept(), new socket()) we'll find array 2 socket objects. calling foo(32, mysocketarray) not work. however, if signature varargs of arrays can pass 1 or more arrays , two-dimensional array. example, void bar(int bar, printstr...

java - Double-Checked Locking without creating objects -

i'm using double-checked locking (dcl) avoid need of synchronization on object if not needed so. in case need synchronize when buffer empty, have "processing thread" wait "delivery thread" notify again - otherwise, "processing thread" run in loops without doing useful. both threads share these objects: object bufferlock = new object(); queue<command> commands = new concurrentlinkedqueue<>(); // thread safe! thread 1 ("delivery thread" - fills buffer): while (true) command command = readcommand(); commands.add(command); synchronize (bufferlock){ bufferlock.notify(); // wake thread 2 (if waiting) } } thread 2 ("processing thread" - empties buffer): while (true){ if (commands.peek() == null){ // not creating here synchronized (bufferlock){ if (commands.peek() == null){ // not creating bufferlock.wait(); } } } command ...

android - Implementing Runnable in MainActivity -

i have activity prints custom date time string textview. implemented runnable interface in mainactivity self , created thread @ end of oncreate method. thread thread = new thread(this); thread.run(); this run method public void run() { while (true) { try { thread.sleep(1000); localtime.settext(localtime.gettime().format2445()); system.out.println(localtime.gettime().format2445()); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } } } when run on emulator can see system out in logcat. emulator shows anr after 5 seconds. doing wrong. method not suitable? async task way go here? need update clock every second having asynctask run forever acceptable pattern? you need start thread.start() http://developer.android.com/reference/java/lang/thread.html quoting docs there 2 ways execute ...

ruby - Can't figure out why match result is nil -

>> "<img src=\"https://filin.mail.ru/pic?width=90&amp;height=90&amp;email=multicc%40multicc.mail.ru&amp;version=4&amp;build=7\" style="">".match(regexp.new("<a href=\"http(s?):\/\/(?:\w+\.)+\w{1,5}.+?\">|<img src=\"http(s?):\/\/(?:\w+\.)+\w{1,5}.+?\"(?: style=\".+\")?>")) => nil but testing in rubular says should catched link i can't understand why testing rubular says string should catched, , not. regex wrong tool handling html (or xml) 99.9% of time. instead, use parser, nokogiri : require 'nokogiri' html = '<img src="https://filin.mail.ru/pic?width=90&amp;height=90&amp;email=multicc%40multicc.mail.ru&amp;version=4&amp;build=7" style="">' doc = nokogiri::html(html) url = doc.at('img')['src'] # => "https://filin.mail.ru/pic?width=90&height=90&email=multicc%40...

vim - What does @ and ~ mean at the bottom? -

when i'm editing plain text files (not code files), sometime see signs @ , ~ @ bottom in different colors scroll, , disappear. mean in vim? the @ sign appears @ bottom when have long line of code (or text) continues (wraps) next line. the ~ sign place holder says nothing on line (not spaces or tabs or returns)

c++ - how can i get the number of bytes available to read on async socket on linux? -

i have simple tcp/ip server written in c++ on linux. i'm using asynchronous sockets , epoll. possible find out how many bytes available reading, when epollin event? from man 7 tcp : int value; error = ioctl(sock, fionread, &value); or alternatively siocinq , synonym of fionread . anyway, i'd recommend use recv in non-blocking mode in loop until returns ewouldblock . update: from comments below think not appropriate solution problem. imagine header 8 bytes , receive 4; poll/select return epollin , check fionread , see header not yet complete , wayt more bytes. these bytes never arrive, keep on getting epollin on every call poll/select , have no-op busy-loop. is, poll/select level-triggered . not edge triggered function solves problem either. at end far better doing bit of work, adding buffer per connection, , queuing bytes until have enough. not difficult seems , works far better. example, that: struct connectiondata { int sck; std::...

state pattern: does it make sense to use it if each state is only allowed to perform just 1 or 2 actions? -

1) extreme case: have 10 states , 10 possible actions perform (that result in state transitions). each of these actions allowed in particular state. state 1 can perform action 1, state 2 action 2, , on (a simple graph goes forward) 2) opposite case: have 10 states , 10 possible actions perform, each of them allowed in every state. of them behave in same way among couple of states, behave same in every state , others work differently in each (like strategy) i have presented 2 extreme scenarios. i'd have opinions on do. combining patterns too. think of states phases in simple game. have title state, menu state (plus sub-menus inherit main menu state), actual game state, , maybe credits state. each of these individual states has own functionality , purpose, , not shared, else why need own state? if have functionality shared between states, should sort of inheritance. in example, involve making base menu state, individual menu state each menu (main menu, options menu...

c - Does ctype.h still require unsigned char? -

traditionally, - strictly speaking - error pass signed char ctype.h predicates because defined -1 255, -128 -2 end in reading outside array bounds. was ever fixed, or still strictly speaking have use unsigned char avoid undefined behaviour in modern versions of c? do still strictly speaking have use unsigned char avoid undefined behavior in modern versions of c? yes, c11 draft standard section 7.4 character handling <ctype.h> paragraph 1 says ( emphasis mine ): the header declares several functions useful classifying , mapping characters. 198) in cases argument int, value of shall representable unsigned char or shall equal value of macro eof . if argument has any other value, behavior undefined . this holds draft c99 standard well, can find in same section.

python - Using data from CSV to make directories -

i have .csv file such following: name1,name2,name3 , on using python script trying have read .csv , make directories each value eg: name1,name2,name3 create these directories : name1 , name2 , name3 this code far: import os import fileinput textfile = 'e:/videos/movies/subtest/dirlist.csv' path = "e:/videos/movies/subtest/" #generate txt file current names of directories def makefile(): # open file dirs = os.listdir( path ) # print files , directories file in dirs: #open file tfo = open(textfile, "ab+") #write file, seprating each item "||" tfo.write( file + ',' ) #print output print ( file ) #prints confirmation print 'file printed!' #close file tfo.close() mainmenu() def makedirs(): #open textfile read , set varible mylistread mylistread = open(textfile, 'rb+') #reads x amount of lines , stores st...

Mediawiki: how do I create a list of wanted articles in the Main namespace? -

mediawiki provides special page view "wanted pages" (pages linked don't have existing articles yet) visiting /special:wantedpages on wiki. check out wikipedia's wanted pages see i'm talking about. my issue wanted pages list fill pages special namespaces. @ moment wiki chock full of wanted pages in template, talk, , category namespaces, name few. with many links special namespace pages, articles in main namespace (the ones users care about) getting lost. there way (through extension or have you) create list of wanted pages in main namespace? see wantedpagesfromns extension. however, have make minor edit extension source files work latest versions of mediawiki (1.20+). rename downloaded .zip file .7z can expand it. copy wantedpagesfromns folder extensions folder of mediawiki installation. open wantedpagesfromns.php file , comment out line reads wfloadextensionmessages( 'wantedpagesfromns' ); . (that function deprecated in mediawiki...

node.js - UTC DATE in Sequelize.js -

i'm using sequelize in node.js save open , close times. i'm using moment.js format. alter findorcreate i'm doing this: result.open = moment(hours.open, "hh:mma").format("yyyy-mm-dd hh:mm:ss"); result.save() ... this works fine , time gets formatted mysql's datetime format. problem when retrieve time seqquelize thinks it's utc time , converts est (my server timezone). i prefer go database utc , come out same way. there i'm doing wrong? why sequelize not convert utc on insert assumes it's utc coming out? also, there way not have try convert server timezone? i know pretty late here struggling postgres (maybe can point in right direction other engines) as know postgres stores datetimes in utc. the issue, me, turned out not in sequelize rather in pg package. in order fix it, place before sequelize = new sequelize() line var types = require('pg').types; var timestampoid = 1114; types.settypeparser(1114, fun...

mongo java - Mongodb Logs shows too many connections open -

why mongodb logs show many opened connections? it's showing me more maximum connection limit , number of current operations in db. also primary refused create more connections after reaching 819 limit. time, number of current operations in db less 819. raising ulimit has solved problem temporarily, why idle connections not utilized serve requests? i having exact same problem. connection number kept growing , growing until hit 819 , no more connections allowed. i'm using mongo-java-driver version 2.11.3. has seemed fix problem explicitly setting connectionsperhost , threadsallowedtoblockforconnectionmultiplier properties of mongoclient. before not setting these values myself , accepting defaults. mongoclientoptions mco = new mongoclientoptions.builder() .connectionsperhost(100) .threadsallowedtoblockforconnectionmultiplier(10) .build(); mongoclient client = new mongoclient(addresses, mco); //addresses pre-populated list of serveraddress objects i...

drop down menu - Javascript Go button -

i create go button current code, don't know how. jquery(function($) { var data = [ // data ['select province', [ 'select city' ]], ['alberta', [ 'select city', 'airdrie', 'calgary', 'cold lake', 'edmonton', 'fort saskatchewan', 'grande prairie', 'leduc', 'lethbridge', 'medicine hat', 'red deer' ]], ['british columbia', [ 'select city', 'abbotsford', 'burnaby', 'chilliwack', 'coquitlam', 'kamloops', 'langley', 'nanaimo', 'new westminister', 'north vancouver', 'port coquitlam', 'port moody', 'prince george', 'richmond', 'surrey', 'vancouver', 'vernon', 'victoria' ]], ['manitoba', [ 'select city', 'brandon', 'dauphin', '...

Drawing a line ActionScript 3 not working -

hello have piece of code drawing simple line doesn`t if possible tell me mistake thankful!!! here code: function click2(e:mouseevent):void{ e.currenttarget.removeeventlistener(mouseevent.click, click2); fx=mousex; fy=mousey; var i:int; i=2; trace(i); trace(sx,sy); trace(fx,fy); var line:shape = new shape(); line.graphics.beginfill(0x0066ff); line.graphics.moveto(400, 300); line.graphics.lineto(400, 400); this.addchild(line); } thank , appreciate community of website, , guys me see mistakes, i m beginner i m doing becouse of people heart!!! you drawing line have set linestyle : function click2(e:mouseevent):void { e.currenttarget.removeeventlistener(mouseevent.click, click2); fx=mousex; fy=mousey; var i:int; i=2; trace(i); trace(sx,sy); trace(fx,fy); var line:shape = new shape(); line.graphics.linestyle(1, 0x0066ff, 1); line.graphics.moveto(400, 300); line.graphics.lin...

html - Accessing JSON through Jquery returns "undefined" -

i'm writing small script take schedules json document , present them in list view. i'm having hard time getting right values return when access json document, in continues "undefined" here's json doc. { "ferries": { "horseshoebay": {/*bunch of schedules here*/}, "departurebay": {/*bunch of schedules here*/}, "dukepoint": {/*bunch of schedules here*/}, } } and here's js $.getjson("includes/json/ferries.json", function(e){ var depart = e; $("#content").append("<ul id='depart-list'>"); $.each(depart.ferries, function(i, item) { console.log(item.result); }); $("#content").append("</ul>"); }); as can see i'm trying log results, come number of values attached key "ferries" undefined , i'm not sure why. any appreciated. edit hey, tried using "item" supplied commenters my each ...

javascript - Regular expression to search for at least 2 letters per line -

please tell me regular expression search @ least 2 letters in string. letters can anywhere , in case. minimum of 2 letters in string. example (javascript): /someregex/i.test(' w89u7'); /*should return true*/ /someregex/i.test(';te1 53#-00'); /*should return true*/ /someregex/i.test('232 3!4-22-1r*7'); /*should return false*/ ps: , sorry english. try using this: /[a-z].*?[a-z]/i

d3.js - Create a Graduated Symbol Map using D3 -

i'm trying create graduated symbol map , struggling find way make happen. can create pie charts , can create symbol map, how place pie charts @ specific coordinates on map? i've placed proportional symbols @ proper coordinates, can't figure out how replace symbols pie charts. every attempt leaves me empty map. i've tried merge mike bostock's pie multiples example symbol map example have instead managed expose lack of understanding of d3's data , event functions. index.html <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"/> <title>graduated symbol map</title> <script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script> <script type="text/javascript" src="http://d3js.org/topojson.v1.min.js"></script> <script type="text/javascript" src=...

json - Adding StateCode dash StateName to the autocomplete using MVC4.5 and a JsonResult -

i trying state code followed dash , state name using ajax autocomplete syntax. i'm using jquery , jqueryui , jqueryui autocomplete function attempt this. i using json result: [{"code":"ak","name":"alaska"},{"code":"al","name":"alabama"}, {"code":"ar","name":"arkansas"},{"code":"az","name":"arizona"}, {"code":"ca","name":"california"}, ... ] and i'm using jquery ajax call embedded $.ajax({ url: '/cats/state/list', type: 'post', datatype: 'json', success: function (data) { $('#cat_statecode').autocomplete( { source: data.code + '-' + data.name, minlength: 2 }); } }); the mvc controller json result looks this: p...

html - Opacity in nested div tag -

this question has answer here: opacity of background-color, not text [duplicate] 5 answers i looking css solution can set lower value of opacity background color, , text on b opaque. i tried this: <div style="opacity: 0.4; background:none repeat scroll 0% 0% rgb(242, 242, 242); "> <div style="opacity: 1;"> complete opaque text on background color </div> </div> but didn't work. here opacity both both background color , text getting changed per outer div opacity value. can please suggest solution? you can use rgba set semi-transparent colors: <div style="background:rgba(242, 242, 242, 0.4);"> <div> complete opaque text on background color </div> </div> the opacity of child element never higher parent's opacity, if parent's op...

Getting error while reading local file in node.js -

i trying read local file using node.js. npm module trying execute child process , inturn opens file read. while reading throws error { [error: enoent, open 'e:\project\secintegrator\attack\manifest.json'] errno: 34, code: 'enoent', path: 'e:\\project\\secintegrator\\attack\\manifest.json' } actual path read file e:\project\secintegrator\node_modules\restscannerdriver\garudrudra\attack\manifest.json i have used var configpath = path.join(path.dirname(fs.realpathsync(__filename)), '/'); calculate absolute path still not working. inside npm module path changes. try use __dirname in npm , create realpath that: var filepath = fs.realpathsync(__dirname+'/'+relative path here file); after what's result of filepath

cakephp does not save cookie -

i have simple code in appcontroller beforefilter function, set cookie $this->cookie->name = 'mycookie'; $this->cookie->time = '1 hour'; $this->cookie->domain = 'example.com'; $mycookie = $this->cookie->read('my_cookie'); if ( empty($mycookie) ) { $this->cookie->write('my_cookie', 'cookievalue', true); } else { echo $mycookie;die; } so, refresh page second time should echo cookie's value. not. output nothing. ideas can problem ? i use cake 2.3.1. cookie component included. debug level 3 , there no errors. have checked cake logs file - nothing there. thanks

Android: how to override ContentProvider's ParcelFileDescriptor openFile method to send file from url as attachment via email? -

i've searched lot did not stumble upon have do. when click send email file shown attached never receive attached file there special way send attachments receive url? here activity code: http://pastebin.com/uzdjyxab[2] , here project https://docs.google.com/file/d/0b-91m-6zevwcrtytyxrgb3l6uve/edit?usp=sharing code "send email" button: sendemail_button.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub intent intent = new intent(intent.action_send_multiple); intent.settype("*/*"); intent.putextra(intent.extra_subject, "attachment app"); intent.putextra(intent.extra_text, "sending mp3 file " + title); intent.putextra(intent.extra_email, new string[] {"some_emai...