Posts

Showing posts from September, 2010

android - Setting border around Button dynamically? -

is possible set border around button dynamically in android? can use statically stroke in shape not know how code. it's deprecated in newer versions of android, use setbackgrounddrawable() call change how our buttons dynamically in code: mybutton.setbackgrounddrawable(res.getdrawable(r.drawable.btn_gray)); if define drawable has border style want should update when need to. if you're using later version of api, should able call mybutton.setbackground() instead.

Table relationship design in mysql -

i little bit confuse table relationships. wish 1 clarify, , tell me going wrong. i have 3 tables, 1 stores students basic info ---{students_info},the other stores classes---{students_class} , other stores positions ---{students_positions}. students_info st_id | f_name | l_name 1 | quinoo | mickel 2 | nunoo | gyan 3 | kwanis | nnipa students_class cl_id | class | academic_year |st_id 13 | | 2013 | 2 32 | b | 2014 | 1 73 | c | 2014 | 3 students_positions pos_id | positions | ushered_year | st_id 54 | president | 2013 | 2 34 | secretary | 2014 | 3 this have done far. friend saw tables , relationships , like, best create table contain ids column values in addition table have, wat suggested students all_std | st_id | cl_id | pos_id 01 | 1 | 32 | null 02 | 2 | 13 | 54 03 | 3 | 73 | 34 thanks helping. i don't see what's

docusignapi - Unable to convert to PDF when creating a draft envelope and attach 2 different document types in the multi-part form -

can please confirm bug or let me know did wrong? using rest api create draft envelope 2 documents of mixed formats. first document either word, powerpoint or excel spreadsheet, , second document text file. received error "system unable convert pdf" trying convert first document. i have tried making changes following no luck added header "content-type" 2 files specify fileextension attribute in document section of xml added fileextension="" in header content-disposition 2 files also have tried following changes , working reversing sequence of document. if put text document 1st , word document 2nd, envelope created successfully. took out 2nd text document , route 1st word or excel document, envelope created. any appreciated.

sql - Alternative to MySQL LOAD LOCAL INFILE REPLACE to update a table -

if have file: 1 someval1 2 someval2 ... and table in mysql ------------- |id | value | |-----------| | 1 | null | | 2 | null | ... and goal set value in right column of table value in right column of csv file wherever id's match. can use query (but don't want to) load data local infile 'file' replace table mytable fields terminated ' ' lines terminated '\n' (id, value); the reason don't want use replace because according mysql docs, deletes entire row whenever there match on primary key (in case, 'id') , reinserts row information in file. i'm assuming means @ point in future if add column table, i'd have make sure whatever file using query contained of column values every row might updated; otherwise non-targeted columns deleted. isn't there better alternative updating table using local file 1 (or maybe more?) columns in input file contain primary keys need matched? one possible approac

javascript - add 2 values and total them in one innerHTML -

i still learning js, , stuck once again, trying add 2 drop down menu values , total them in 1 innerhtml. i trying take value2 phones/devices (item) add value new activation (item1) drop down , total them in commission innerhtml. in js, commission line cost. i have tried adding element in cost line, , did not work. tried adding item cost line. here html , js <table width="50%" border="0"> <tr> <td width="20%"><div align="center">item</div></td> <td width="20%"><div align="center">new activation</div></td> <td width="20%"><div align="center">commission</div></td> <td width="20%"><div align="center">price</div></td> <td width="20%"><div align="center">meid</div></td> <td width="20%">&

php - WAMP icon is orange - tried skype and install apache service fixes -

Image
my wamp icon randomly orange. think change i've made computer installing windows visual studio express. i've followed on solving it... including changing skype port , installing apache service fixes: wampserver 2.1 gives orange icon after install on windows 7 it gives following... have no idea microsoft-httpapi/2.0 is... more importantly why wamp isn't running on port: other things i've tried: in system32/drivers/hosts file, change ::1 localhost 127.0.0.1 localhost , set correct way: http://forum.wampserver.com/read.php?2,70321 look in wamp apache error log: nothing any other suggestions? edit: this 1 bit me - see http://www.ferolen.com/blog/microsoft-httpapi2-0-use-port-80-cannot-start-wamp-apache/ more detail. need deactivate "web deployment agent service" (msdepsvc) service. several references service here on well, here , doesn't seem useful @ when you're using non iis stack.

javascript - Issue on Resetting Custom jQuery Spinner -

i have simple custom jquery spinner @ this demo working fine me having issue on resetting value initial. can see demo , following code able set text of #targeteg .html(targets[0]); if start + or - counter again continues before setting value counting! var targets = ["target km", "1,000 km", "3,000 km", "5,000 km", "7,000 km"]; var = 0; $("#plus").on("click", function () { if (i < 4) { $("#targeteg").html(targets[++i]); } }); $("#minus").on("click", function () { if (i > 0) { $("#targeteg").html(targets[--i]); } }); $("#resetform").on("click", function () { mapreset(); function mapreset() { $("#targeteg").html(targets[0]); } }); can please let me know how fix after resetting every thing starts beginning reloading page time. thanks just set i=0 in reset function function mapreset() { = 0;

Getting syntax error when trying to install googlemaps module in python via pip -

i beginner in python. trying install google maps module in python getting syntax error. below error message. please help. (gmapenv) c:\python\virtual environment\gmapenv\scripts>pip install googlemaps downloading/unpacking googlemaps running setup.py egg_info package googlemaps traceback (most recent call last): file "<string>", line 16, in <module> file "c:\python\virtual environment\gmapenv\build\googlemaps\setup.py", li ne 18, in <module> import googlemaps file "googlemaps\googlemaps.py", line 471 print main.__doc__ ^ syntaxerror: invalid syntax complete output command python setup.py egg_info: traceback (most recent call last): file "<string>", line 16, in <module> file "c:\python\virtual environment\gmapenv\build\googlemaps\setup.py", line 1 8, in <module> import googlemaps file "googlemaps\googlemaps

android - How to specify commandline arguments in settings.gradle -

i compiling android project gradle , want run -x lint every build. is possible use settings.gradle automatically add this? you add following root project's build.gradle : gradle.startparameter.excludedtasknames << "lint"

jquery - Dynamic Page Based On Dropdown Selection -

i working on sign system. there different prices different membership types. associate $25, family $40, regular $35, regular family $40, honary $0, , institutional $25. need dropdown menu change amount due based on membership selected. my code right now: <p>current status: <select name="status_current"> <option value="">please select</option> <option value="a">associate</option> <option value="f">family</option> <option value="r">regular</option> <option value="rf">regular family</option> <option value="h">honary</option> <option value="i">institutional</option> </select> </p> first, include jquery in page, this: <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> </head> i use jquery this: $(

jquery - MVC - Why is Ajax call to Controller Action parameter always null? -

i making ajax call controller action using .get parameter null when controller action fired. trigger .on(change) event in jquery script contained in _layout.cshtml . posted question earlier, thread got trashed unrelated chatter. can me troubleshoot why happening? here code: partial view: ~/views/shared/_languagelistpartial.cshtml @html.dropdownlistfor( x => x.selectedlanguage, model.languages, new { @class = "form-control" } ) _layout.cshtml <form action="/account/listpartial" method="post" class="navbar-form navbar-right nopadding" role="" style="margin: 8px 0;"> @{html.renderaction("languagelistpartial", "account");} </form> <div id="test"></div> get: /account/languagelistpartial [allowanonymous] [childactiononly] public actionresult languagelistpartial() { // retrieve user's language preference. default = en-us strin

c# - How do I allow whitespace with Regex.Replace -

i have created web service method in asp.net c#, , using regex.replace method beacause of invalid characters returning in result, how allow white space in method,because in regex.replace method, white space eliminated. see code: public string list(long empid, string name, string pwd, long id) { httpwebrequest request = (httpwebrequest)webrequest.create(link); request.connection = regex.replace((empid, name, pwd, id), "[^\"a-za-z0-9_?<>+=./:-]", ""); string connection = request.connection; return connection; } if use space in regex.replace this: request.connection = regex.replace((empid, name, pwd, id), "[^\"a-za-z0-9_?<>+=./:- ]", ""); i getting error: system.argumentexception: parsing &quot;[^&quot;a-za-z0-9_?&lt;&gt;+=./:- ]&quot; - [x-y] range in reverse order. you can add character class. [^\"a-za-z0-9_?<>+=./: -] if use space this: [^\"a

php - nearby location and matching keys locations -

i want nearby location given latitude , longitude using google api and list of locations match passed address text. i tried https://developers.google.com/places/documentation/search https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362 &rankby=distance&types=food&key=addyourownkeyhere but can not pass text here, how combination of both, using lat long nearby location or text matching areas let me share key key=aizasydizrd38fgzxpxg98cjd7eeot8xvay6_ww please give me working url updated: i need 2 api 1) textsearch for tried https://maps.googleapis.com/maps/api/geocode/json?address=iscon but not giving giving results (here want autocomplete more 5 results) 2) nearbyseach for tried https://maps.googleapis.com/maps/api/place/nearbysearch/json?radius=500&location=34.0522,-118.244&key=aizasydizrd38fgzxpxg98cjd7eeot8xvay6_ww , working fine try this, may filter results more accurately :

Linking a Facebook Page to android -

does know link page created in facebook (company/fan page ) like button in android. have @ following questions , answer, see if same looking for. documentation question 1 question 2

extjs4.2 - ExtJs - Textfield rendered via renderer doesn't get click focus? -

i'm using propertygrid building tabular from. when use renderer return textfield, can't click , type in textfield. doesn't focus. way fix it? also, there way render extjs element instead of raw html element renderer? in grid,column renderers return html text, it's not possible return components directly. thing assign unique id cell , defer actual component creation. { header: 'row7', align: 'center', renderer: rendercmp, dataindex: 'cmpname', width: 100 } // renderer function function rendercmp(value, id, r) { var id = ext.id(); if (r.data.cmpname ) { creategridbutton.defer(10, this, ['one', id, r]); return('&lt;div id="' + id + '"&gt;&lt;/div&gt;'); }else { creategridbutton.defer(10, this, [

Java Http Client get 408 Request Time-out -

i developing simple http client, have problem here: when using telnet on windows command line : telnet download.microsoft.com 80 head / http/1.1 host: download.microsoft.com response: 301 moved permanently head /download/7/a/9/7a9ebb22-8dc8-40a2-802d-b4cc343a928e/proplussp2013-kb2817430-fullfile-x86-vi-vn.exe http/1.1 host: download.microsoft.com response: 200 ok when using program (eclipse ide, jre8) java code: import java.io.*; import java.net.*; public class main { public static datainputstream in; public static bufferedwriter out; public static string host = "download.microsoft.com"; public static int port = 80; public static socket soc; public static string getheader(string uri) throws ioexception{ string httprequest = "head " + uri + "\r\n" + "http/1.1\r\n" + "host:" + host + "\r\n"; string httpresponse = &quo

android - Viewport Units not working in Cordova Mobile App -

i'm trying responsive web design app adapts multiple screens. hence used viewport units(vw , vh) in css every thing font-size margin. cordova webview not supporting viewport units. i'm stuck here. is there way workaround vh , vw units work on cordova webview? or there other way of getting responsive web design app can release across multiple screens(android). thanks in advance. i got js workaround works fine in cordova app code: var w=$(window).width()/100; var h=$(window).height()/100; function vw( val ) { return w*val+'px'; } function vh( val ) { return h*val+'px'; } $('.header p').css({ fontsize: vw(4), margintop: vh(2) }); simple isn't it?

ruby on rails - httparty not working with localhost -

i making rails app contain apis , want controllers call apis instead of dealing activerecord . i using httparty making calls. when following working fine. response = httparty.get('https://google.com') but when try api call keeps on processing status browser sending request waited 15 minutes rendered nothing , saw rails console there no sign of request. for api call using this: response = httparty.get('http://localhost:3000/api/v1/score_sheets/9') even tried this: response = httparty.get('http://0.0.0.0:3000/api/v1/score_sheets/9') and also: response = httparty.get('http://127.0.0.1:3000/api/v1/score_sheets/9') making direct request through browser https://localhost:3000/api/v1/score_sheets/9 returns right json . problem: wrong sending request localhost using method? or other possible way of doing this? in development mode, 1 instance of app processes 1 request @ time (in production, of rails 4, thread safe mode enab

php - bigcommerce API update product issue "The field 'calculated_price' cannot be written to. Please remove it from your request before trying again" -

can 1 solve issue.... fatal error: uncaught client error (400): field 'calculated_price' cannot written to. please remove request before trying again. $old_product = bigcommerce_api::getproduct($bid); $old_product->name = $_post['part_number']; $old_product->price = $_post['price']; $old_product->weight = $_post['weight']; $old_product->width = $_post['width']; $old_product->categories = array($_post['categories']); $old_product->height = $_post['height']; $old_product->depth = $_post['depth']; $old_product->description = $_post['longdescription']; $old_product->update(); using bigcommerce::updateproduct() method works, try this $fields = array( "name" => $_post['part_number'], "price" => $_post[&

c# - applying unit of work in a generic repository -

i'm learning on doing repository unit of work. know how di/ioc. problem can't figure out apply unit of work in code. below generic repository. public abstract class repository<t, c> : //idisposable, irepository<t> t : class c : dbcontext, new() { private c entities = new c(); public c context { { return this.entities; } set { this.entities = value; } } public virtual void insert(t entity) { this.entities.set<t>().add(entity); } // remove code brevity } what had tried far: make unit of work class public class unitofwork : iunitofwork { private readonly foocontext _dbcontext; public unitofwork() { _dbcontext = new datacontext; } public void save() { _dbcontext.savechanges(); } // dispose method } in service: public cl

database - Uploading a webpage made via Laravel on a core PHP based website -

how upload laravel based webpage on php server? main website coded in core php , made webpage using laravel. guy working uploading of webpages didn't know how integrate either? tell me how can upload webpage coded via laravel on php server? laravel php framework , individual laravel webpages not exist - define routes , use controller method direct request appropriate view or response ( look mvc ). if made single route, controller , view , want html on live site copy generated page source static html file. need stylesheets , scripts go it. bad idea in terms of maintainability , ease of deployment though. should either make entire site (or section of site) in laravel or not @ all. alternatively need install laravel application on web server following the docs .

dom - Accessing the current tab with chrome extension -

i want access tab using chrome extention , able html code it. possible? thanks ahead. your question in not precise. need html code? want it? one way html code use content script . javascript file executed when page loaded. can acces dom normaly. if need background page. there other ways this. please update quesition , update answer.

sql - simplify multiple group clauses -

ok, have following query: select p.[page_id] , count(*) count ( select p.[page_id] , o.country_id [pages] p join page_item_position pip on p.page_id = pip.page_id join items on pip.item_id=i.item_id group tp.page_id, i.country_id) p group p.page_id so, pages have items, items have countries , items exist @ particular position on page (this not related issue though). nothing complicated here. what i'm trying find out, how many different countries represented on each pages, query above does. however, can't think little on complicated. the inner query groups such direct listing of specific countries against pages, , outer part groups result id again give me count. can query simplified? try this: select p.[page_id], count(distinct i.country_id) [pages] p inner join page_item_position pip on p.page_id = pip.page_id inner join items on pip.item_id=i.item_id group p.page_id

osx mavericks - How to select XCode 3.2.6 with xcode-select? -

i have upgraded mac os 10.9.3 mac os 10.6.8 . had xcode 3.2.6 installed. new developments, needed install xcode 4.5.2 . in maven build, invoke xcodebuild build c++ projects. problem need xcodebuild 3.2.6 build projects, , xcodebuidl 4.5.2 new ones. i need able choose on-the-fly xcodebuild version launch build on project. saw xcode-select me doing this, stuck on way use xcode-select choose xcodebuild 3.2.6 . considerong xcode 4.5.2 installed @ /applications/xcode.app , using command sudo xcode-select -switch /applications/xcode.app does job, as xcodebuild -version outputs xcode 4.5.2 build version 4g2008a considering xcode 3.2.6 @ /developer/applications/xcode.app , problem is, why command not work? sudo xcode-select -switch /developer/applications/xcode.app it outputs xcode-select: error: invalid developer directory '/developer/applications/xcode.app' the workaround find using absolute path use xcodebuild 3.2.6, that's tricky: /develop

visual c++ - Convert all instances of "\" to "\\" in System::String^ and convert to char* -

i have openfiledialog returns filename. want save filename char* can open later using fstream . i'll need replace instances of \ \\ in string. my tactic doing split system::string^ on every instance of \ , , join elements of resulting system::string^ array \\ separating them. this function have written, seems return blank string when pass string^ contains \ . private: const char* getcharpointer(string^ name){ array<string^>^ words; string^ delimstr = "\\"; array<char>^ delimiter = delimstr->tochararray( ); string^ replacedelim = "\\\\"; words = name->split(delimiter); string^ tidiedname = string::join( replacedelim, words ); label1->text = tidiedname; std::string newname=msclr::interop::marshal_as< std::string >( tidiedname); const char* name_cstr = newname.c_str(); return name_cstr; } i newcomer visual c++ , windows in general appreciate pointers on this. doesn't intel

knockout.js - knockoutjs function argument ordering -

i want confirmation regarding argument ordering in knockout js method binding situationa: if send in $data , event, first argument data, second argument dom event <a data-bind="click: $root.myfunction.bind($data)" href="#">add sheet</a> self.myfunction = function (data, event) {} situationb: if send in parameter, $data becomes last parameter in myfunction, while myparam holds value "funnyworld" <a data-bind="click: $root.myfunction.bind($data,'funnyworld')" href="#">add sheet</a> self.myfunction = function (myparam, data) {} do understand arugment order correctly? situation a: $root.myfunction.bind($data) would cause this in myfunction current view-model ( $data ). usual arguments passed knockout well, arguments be: self.myfunction = function (arg1, arg2) { // === $data // arg1 === $data // arg2 === event } situation b: $root.myfunction.bind($data, '

C++ Create and Save OpenCV 16bit image pixelwise -

Image
i create 16bit png-image opencv setting pixel values manually noise generation. tried following: cv::mat img16(window_y, window_x, cv_16uc3); // create 16 bit mat float val, new_value; float noise = 3.1343; // randomly generated randomizer in (0..255) (int x = 0; x < window_x; x++) { (int y = 0; y < window_y; y++) { (int = 0; < 3; i++) { // value cv_8uc3-mat val = img.at<cv::vec3b>(y,x)[i]; // add noise , scale 16bit new_value = (val + noise)*255; // avoid overflow @ 2^16-1 if (new_value > 65535) { new_value = 65535; } // set value 16bit mat img16.at<cv::vec3s>(y,x)[i] = (short) new_value; } } } // write png file, since png supports 16 bit cv::imwrite(file + ".png", img16); what output seems 16 bit: $ identify output.png output.png png 128x128 128x128+0+0 16-bit pseudoclass 65536c but sho

android - onActivityResult() not called in fragment and activity finishes -

i have fragment within activity , using button select notification sound using ringtone picker: selectsound.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { intent intent = new intent(ringtonemanager.action_ringtone_picker); intent.putextra(ringtonemanager.extra_ringtone_type, ringtonemanager.type_notification); intent.putextra(ringtonemanager.extra_ringtone_title, "select tone"); if (notification != null) { intent.putextra(ringtonemanager.extra_ringtone_existing_uri, (uri) notification); } log.v("tasks", "starting ringtone picker reminders"); startactivityforresult(intent, 5001); } }); here's onactivityresult in fragment: @override public void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); l

java - Failed to invoke Method. Message payload is of type: String -

Image
i have created mule connector using devkit, accepts string, when tried run mule application using connector , throuws "failed invoke myprocessor. message payload of type: string". should do? exception stack is: 1. parameter username in method connect can't null because not @optional (org.mule.modules.duoasset.connection.unabletoacquireconnectionexception) org.mule.modules.duoasset.connectivity.duoassetconnectorconnectionmanager:260 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/modules/duoasset/connection/unabletoacquireconnectionexception.html) 2. failed invoke myprocessor. message payload of type: string (org.mule.api.messagingexception) org.mule.devkit.processor.devkitbasedmessageprocessor:128 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/messagingexception.html) -------------------------------------------------------------------------------- root exception stack trace: org.mule.modules.duoasset.connection.unabletoacquirecon

node.js - Appending url query -

this first time create application using nodejs , need little help. want append query in url clicking button. the website has search box, , navigation sorting(most viewed,most downloaded) ex: when searching foo , url this. localhost:3000/search?q=foo but when clicked most viewed button, result be localhost:3000/search?tab=views expected result localhost:3000/search?q=foo&tab=views i found solution, checked how stackoverflow.com handles search. example, searched "hello world" here in stackoverflow. the url https://stackoverflow.com/search?q=hello+world and button/links following be: relevance = https://stackoverflow.com/search?tab=relevance&q=hello+world newest= https://stackoverflow.com/search?tab=newest&q=hello+world sorry if question unclear solution looking for.

How to POST .json file in Powershell without Invoke-WebRequest? -

what doing: invoke-webrequest -uri https://coolwebsite.com/ext/ext -contenttype application/json -method post -body $somejsonfile i looking way post same .json file in powershell without using invoke-webrequest , if possible. new method preferably allow me server output content , parse through in powershell. maybe calling outside curl method? not sure , internet research has proved fruitless. how can achieve above result without invoke-webrequest? you can try : # restrequest.ps1 add-type -assemblyname system.servicemodel.web, system.runtime.serialization, system.web.extensions $utf8 = [system.text.encoding]::utf8 function request-rest { [cmdletbinding()] param ( [parameter(mandatory=$true)] [string] $url, [parameter(mandatory=$false)] [system.net.networkcredential] $credentials, [parameter(mandatory=$true)] [string] $json) # remove newline json $json = $json -replace "$([environment]::newlin

c# - Reading an integer from user input -

what looking how read integer given user command line (console project). know c++ , have started down c# path. know console.readline(); takes char/string. in short looking integer version of this. just give idea of i'm doing exactly: console.writeline("1. add account."); console.writeline("enter choice: "); console.readline(); // needs take in int rather string or char. i have been looking quite while this. have found lot on c not c#. did find thread, on site, suggested convert char int. i'm sure there has more direct way converting. you can convert string integer using convert.toint32() function int inttemp = convert.toint32(console.readline());

Is javascript geolocation inside an html5 page calculated different for each mobile browser? -

if insert following code html5 page geolocation work on safari ios, android , blackberry browsers? getviahtml5 = function(done) { if(navigator.geolocation) { navigator.geolocation.getcurrentposition(function(position) { vicinity.lat = position.coords.latitude; vicinity.lng = position.coords.longitude; done(); }, function(e) { console.warn('error(' + e.code + '): ' + e.message); }); } else { console.warn("browser doesn't support geolocation"); } }; i'm not asking if actual code correct. i'm asking if javascript geolocation on html5 page work various mobile browsers or there different method each browser (safari ios, android , blackberry browsers) there 2 methods: html5 geolocation api, , polyfill(s) rest. android, , mobile safari go; had blackberry, you're good: http://developer.blackberry.com/html5/apis/v1_0/navigator.geolocation.html depending on version(s) of ie support, modernzr handles ie8 , up. if

objective c - Smooth UITextView auto scroll to bottom of frame -

im using xcode 5.1.1 developing ios7. there new text entering uitextview, if text went up, leaving room user see new text. have works animation shows new text awkward. if goes top of text , goes bottom every time called. cgpoint p = [textview contentoffset]; [textview setcontentoffset:p animated:no]; [textview scrollrangetovisible:nsmakerange([textview.text length] - 1,0)]; this code getting called every time new text entered. smooth default iphone messenger slides casually. the right answer set: _consoleview.layoutmanager.allowsnoncontiguouslayout = no; in viewdidload then: _consoleview.text = text; [_consoleview scrollrangetovisible:nsmakerange(_consoleview.text.length - 1, 1)];

java - How to extract text using javascript on client side -

i want develop script extract information client side when enter url our site. for exmaple-:if enter url www.example.com,the code intiates , extract information client side.it different each user facebook email etc. so looking @ option , thinking impossible unless have kind of javascript code execute on client side whenever visit site.i looking @ libraries such jsoup,selenium etc guess executes locally , didn't solve purpose. the text want extract in iframe , further in tables.so possible write code (javascript or else )which include in our index.php page , executes on client site,extract information , store results in database? the scenario if user logged in facebook on same browser when visit site,it automatically displays email id related facebook.so want extract email id.any suggestions? edit-->> i trying following code move frame , content returning empty content document. var iframe = document.evaluate('//iframe[contains(@src, \"//my.leadpages

c# - How to store a value and its list of stings in a list -

i need store value , corresponding list of strings in list. like key value 2 2,3 2 4,6 4 3,5,6 should in list here cant use dictionary because same key might repeat. know how kindly help use lookup . dictionary, allows same key multiple times. here docs . have use .tolookup extension method on sequence create one. in case, seems you'd need ilookup<string, ilist<string>> (or int instead of string , don't know data). here's how can generate lookup: ienumerable<keyvaluepair<string, ienumerable<string>> mydata = new[] { new keyvaluepair<string, ienumerable<string>>("2", new[] { "2", "3" }), new keyvaluepair<string, ienumerable<string>>("2", new[] { "4", "6" }), new keyvaluepair<string, ienumerable<string>>("4", new[] { "3", "5", "6" }), }; var myl

node.js - npm install gives error "can't find a package.json file" -

Image
npm install / npm install -g command not working in windows 7 node.js installed properly, node.js version v0.10.28 couldn't read dependencies enoent, open '"filepath"\package.json' not problem npm itself. npm can't find package.json file in current directory. you don't module want install - hence npm looks file package.json describes dependencies, , file missing. so either have explicitly tell npm module install, e.g. npm install express or npm install -g express-generator or have add package.json file , register modules here. easiest way such file let npm create 1 running npm init and add need. please note work locally installed modules, not global ones. a simple example might this: { "name": "myapp", "version": "0.0.1", "dependencies": { "express": "4.0.0" } } or that. more info on package.json file see official docu

error while running any hadoop hdfs file system command -

i new hadoop. referring "hadoop dummies" book. have setup vm following specs hadoop version 2.0.6-alpha bigtop os centos problem while running hdfs file system command getting following error example command : hadoop hdfs dfs -ls error : not find or load main class hdfs please advice regards, try running: hadoop fs -ls or hdfs dfs -ls what return? fs , dfs same commands. difference between `hadoop dfs` , `hadoop fs` remove either hadoop or hdfs , command should run.

knockout.js - Knockout JS Template With Inner Foreach -

<!doctype html> <html> <head> <title>knockout template inner foreach</title> <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript" src="knockout-min.js"></script> </head> <body> <div id="maindiv" data-bind="template: { name: currentsection }" style="border: 1px solid red"> </div> <button data-bind="click: next">next</button> <div id="templateszone" style="display:none"> <div id="template1"> template1 </div> <div id="template2"> template2 </div> <div id="template3"> <div data-bind="foreach: customers">

svn - Subversion: New Project requirements -

i new subversion. working in clearcase past few years. got new project, our client needs work done on subversion, open source sw. newbie , cm our project, know: what requirements initiate project , before going repository creation how make branch structure same clearcase in subversion? what basic requirements initiate project? how tagging can done? these should mention in 1 of document. need inputs. please dont thing bad. queries in perspective of technical , managerial queries. need give inputs manager. inputs professional end? inputs valuable our project. i'd not question can answered in q/a format. suggest reading svnbook learn more apache subversion , version-control in general. i don't understand first question in list, the answer second 1 can found in svnbook | branching , merging , the third 1 unclear, the fourth 1 covered in svnbook | tags . read manual , ask specific questions parts / chapters unclear you.

javascript - right scroll bar of a modal is not coming at the top positon -

i using modal scroll bar @ right coming @ end of message content.but want scroll bar @ top position of message content shows message top. htp.p('<html>'); htp.p('<head>'); web_template.include_css_stylesheets; htp.p('</head>'); htp.p('<body>'); htp.p('<table style="margin:0px;padding:0px;width=103%;" cellpadding=0 cellspacing=0>'); htp.p('<tr><td> <div id="scrolltable" style="width:100%; height:470px; overflow:auto;"> <table cellspacing="0" cellpadding="0" > <tr> <td>'); htp.p('<title>'||message_rec.title||'</title>'); htp.p('<b><u>'||message_rec.title||'</u></b>'); htp.p('<p>'); htp.p(replace(message_rec.message_txt,chr(10),'<br>')); htp.p('</td>

c# - Accessing the internal xml structure of an excel file -

first have not profound c# coder. read in post possible access internal xml structure in excel file. my question is: can done via c# or possible via java ? how can accomplished in c# ? i appreciate answer! this done using openxml sdk .

How to ouput with ECHO into an HTML file HTML code with angle brackets without surrounding double quotes? -

i have written batch file creates html file echo command. example: echo "<html><body><table border="1"><tr><td> copied webfiles @ %date% %time% </td></tr></table></body></html>" >> test.html it's working perfectly, echo command adding double quotes in html code. how avoid double quotes in html file? the solution leaving out double quotes lekensteyn suggested , additionally escape each angle bracket ^ explained @ escape angle brackets in windows command prompt . echo ^<html^>^<body^>^<table border="1"^>^<tr^>^<td^> copied webfiles @ %date% %time% ^</td^>^</tr^>^</table^>^</body^>^</html^>>>test.html there no space between ^</html^> , >> otherwise space written html file. a space between >> , file name test.html ignored , therefore insert here space better readability if bat

mondrian - mdx. Filter values from fact table before aggregate -

i have simple cube 2 dimensions: dim1, dim2, , 1 measure - value (aggregator = sum) need cross table via mdx: select non empty [dim2].members on 0, non empty [measures].value on 1 [cube] => el1 el2 el3 el4 value 12 14 45 64 this values aggregate dim1. ok. next create calculate measure: with [measures].value_filter iif([measures].value> 15, [measures].value, null) select non empty [dim2].members on 0, non empty [measures].value_filter on 1 [cube] => correct result: el3 el4 value 45 64 but, how can filter cells non aggregate values of [measures].value, ie real values database? you can filter members contained in dimension. if want filter on something, has available in cube. hence may potentially have add columns attributes 1 of dimensions. you filtering follows, assuming want use member1 of hierarchy/attribute hier2 of dimension dim2 filter: select non empty [dim2].members on 0, [measures].value on 1 [cube] ([dim2

wordpress - PHP: Show content at certain time -

new php , wordpress. i'm trying show different content @ times (bst). e.g breakfast content: 8am, lunch content 1pm how go creating if loop show content based on current time? below content breakfast. <?php $rows = get_field('breakfast'); $row_count = count($rows); $i = rand(0, $row_count - 1); ?> <h1> <?php echo $rows[ $i ]['dish_name']; ?> </h1> <p> <?php echo $rows[ $i ]['dish_description']; ?> </p> <h3> served<span><?php echo $rows[ $i ]['time_served']; ?></span> </h3> done it. if can done better please let me know. <?php date_default_timezone_set('bst'); $currenttime = time(); $breakfast = strtotime("11:30 am"); ?> <?php if ($currenttime > $breakfast): ?> <h1> <?php echo $rows[ $i ]['dish_name']; ?> </h1> <p> <?php echo $rows[

javascript - <img src="x" onerror="alert(\"hello\")" />) escaping quote is illegal? -

i trying play around escape character. <img src="x" onerror=alert('hello'); /> <img src="x" onerror="alert(\"hello\")" /> the 2nd 1 produces illegal character in dev console. why? why can't use escape character? demo: http://jsfiddle.net/h7nnk/1/ because \ not escape character in html. <img src="x" onerror="alert(&quot;hello&quot;)" /> or, per @mplungjan's comment: <img src="x" onerror="alert('hello')" /> or, better still: <img src="x" id="derp" /> <script type="text/javascript"> document.getelementbyid('derp').addeventlistener("error",function() { alert('hello'); },false); </script>

c# - Convert table html to datatables jquery -

i have table , must transform in "datatables jquery" format (tbody, thead...) , don't know how do, if possible jquery. this table generated (note: return of string method in c# return in string writer): <table cellspacing="0" rules="all" border="1" style="border-collapse:collapse;"> <tbody><tr> </tr><tr> <td>426</td><td>05/06/2014 10:14:21</td><td>119870</td><td>arquivos reunião</td><td>contrato</td><td>victor vasconcelos de aquino</td> </tr><tr> <td>436</td><td>10/06/2014 11:47:29</td><td>119870</td><td>arquivo mapp</td><td>contrato</td><td>victor vasconcelos de aquino</td> </tr><tr> <td>416</td><td>04/06/2014 14:50:07</td><td>119870</td><td>multip

Get the data from json url using php? -

this json api : https://jobs.github.com/positions.json?description=java&page=1 want data url. <?php $url = file_get_contents('https://jobs.github.com/positions.json?description=java&page=1'); var_dump(json_decode($url,true)); ?> this code return null check url in json validator: http://jsonformatter.curiousconcept.com/ json valid con't able data url please me... try script determine problem is. if there no json module installed (see @julian comment), can try use php implementations of json this: http://pear.php.net/pepr/pepr-proposal-show.php?id=198 if (! extension_loaded('json')) { echo 'module json not available!'; exit(); } $url = file_get_contents('https://jobs.github.com/positions.json?description=java&page=1'); $data = json_decode($url,true); switch (json_last_error()) { case json_error_none: echo ' - no errors'; break; case json_error_depth: echo ' - ma

c# - Why is this an incorrect usage of a namespace? -

i'm learning c#, i'm not quite sure namespaces. know leave off "using" statements, , system.console.writeline, or "using system" , "console.writeline", not understand why following doesn't work. using system.console; namespace helloworld { public class program { public static void main(string[] args) { writeline("hello world"); } } } console not namespace, class. writeline static method of class (so don't need instance use it). in fact, console class appears static (so there no instances). you cannot using class in c# 5.0 , earlier. according msdn article ( http://msdn.microsoft.com/en-us/magazine/dn683793.aspx ) can static classes in c# 6.0 (the code wrote compile , work). msdn console class.

Scala Breeze DenseVector Implicit failure -

i've started getting strange error; not sure caused - maybe maven rebuild. can't explain behavior... works in intellij, doesn't, , failing when run jar file. this runtime error: java.lang.nosuchmethoderror: breeze.linalg.densevector$.canscaled()lbreeze/linalg/operators/binaryop and occurs in code: import breeze.linalg._ import breeze.linalg.densevector._ var planenormal = densevector.zeros[double](39) weights.zip(vectors).foreach case(w: double, vector: densevector[double]) => planenormal :+= (vector :* w) } in vector :* w function call. anyone have ideas might wrong? i suspect version mismatch no clue fix it; i'm using breeze-math package <groupid>org.scalanlp</groupid> <artifactid>breeze-math_2.10</artifactid> <version>0.4</version> and scala <groupid>org.scala-lang</groupid> <artifactid>scala-library</artifactid> <version>2.10.3</version> you're using

Java: how to sum element of an array one by one in the same array -

i´ve searched , thought lot can´t come solution. given array of numbers, should sum each element next , write in same array, again , again until first position [0] of array contains sum of elements. example: test[] = {1, 2, 3, 4, 5} next step be: test[0] = test[0] + test[1] = 1 + 2 = 3; test[1] = test[2] + test[3] = 3 + 4 = 7; test[2] = test[4] = 5; array becomes: { 3 , 7 , 5 , 4, 5} then repeats again: test[0] = test[0] + test[1] = 3 + 7 = 10; test[1] = test[3] = 5; array becomes: { 10 , 5 , 5, 4, 5} then finaly again: test[0] = test[0] + test[1] = 10 + 5 = 15; array becomes: { 15 , 5 , 5, 4, 5} i know list right solution exercise solve simple array. suggestions more welcome! again: task not efficency solving using arrays. sorry first post , looks mess. edit: i´ve have come this: for (int = 0; < test.length - (test.length / 2); i++) { test[i] = test[2 * i] + test[2 * + 1]; } works incase of amount of given numbers , needs in loop repeated cor

Jar file which contains the Javadoc? -

is possible create jar file contains javadoc ? for now, i'm creating jar file & javadoc folder. 1. want create jar file contains javadoc , can ? 2. can without attaching source code jar file ? (just jar javadoc) ? thanks the short answer yes. jar file zip manifest , additional features. can put type of file in it, including images, html files etc... have jar javadoc folder classes folder.

java - Moving data to HDFS with Storm -

need understand how hdfs , storm integrated. storm can process incoming stream of data using many nodes. data is, let's say, log entries different machines. how store all? ideally i'd store logs 1 machine 1 or many files dedicated machine. does work? able append same file in hdfs many different storm nodes? ps: still working on getting running can't test physically... bother me. write file in hdfs java no, cannot write same file more 1 task @ time. each task need write it's own file in directory , process them using directory/* if using hadoop

Replacing a number with a word Java -

been digging around internet day looking solution problem. i've started programming 2 weeks ago , fact don't know proper java lingo yet reason i'm not finding i'm looking for. anyway program supposed to: print out numbers 1 100 , if during iteration program comes across number that's divisible 3 has replace number "crackle", if comes across number that's divisible 5 has replace number "pop" , comes across number that's divisible both has replace number "cracklepop i can't print cracklepop numbers divisable both 3 , 5, can print crackle & pop but not replace numbers . i've tried using: integer.tostring(); , integer.valueof(); , integer.parseint(); none of can work. code far: int counter = 0; int max = 100; (int = 1; <= max; i++){ if (counter % 3 == 0) { system.out.println("crackle"); } else if(counter % 5 == 0){ system.out.println("pop");