Posts

Showing posts from January, 2010

bash - Extract number from first line of a file in linux -

i have file has contents below spec.2.attrid=revision& spec.2.value=5& spec.3.attrid=num& spec.3.value=vs& i using below command extract numbers first line. way efficient or guys think of alternate way ? cat ticketspecdata | tr -d " " | tr -s "[:alpha:]" "~" | tr -d "[=.=]" | cut -d "~" -f2 using grep : $ grep -om1 '[0-9]\+' file 2

c# - Windows phone 8 XMLParseException -

i programming first windows phone 8.0 app. want have map on 1 of pages. comes following error: "taskhost.exe" (clr c:\windows\system32\coreclr.dll: defaultdomain): "c:\windows\system32\mscorlib.ni.dll" geladen. das laden von symbolen wurde übersprungen. das modul ist optimiert, und die debugoption "nur eigenen code" ist aktiviert. "taskhost.exe" (clr c:\windows\system32\coreclr.dll: silverlight appdomain): "c:\windows\system32\system.windows.runtimehost.ni.dll" geladen. das laden von symbolen wurde übersprungen. das modul ist optimiert, und die debugoption "nur eigenen code" ist aktiviert. "taskhost.exe" (clr c:\windows\system32\coreclr.dll: silverlight appdomain): "c:\windows\system32\system.windows.ni.dll" geladen. das laden von symbolen wurde übersprungen. das modul ist optimiert, und die debugoption "nur eigenen code" ist aktiviert. "taskhost.exe" (clr

SSIS Expression -

select cast(count(1) varchar(30)) sourcerowcount table countryid= '" +@[user::id] +"'"+ " "+" , locationid ="'+@[user::id1]+'" expected output select cast(count(1) varchar(30)) sourcerowcount table countryid= 1 , locationid =2 use execute sql task step in control flow execute query, passing 2 variable values in parameters, , return value variable, https://www.simple-talk.com/sql/ssis/ssis-basics-using-the-execute-sql-task-to-generate-result-sets/ .

Why aren't python packages from Anaconda being detected by Blender? -

Image
i've been using blender render 3d models of objects , training svm recognize pictures of object taken perspective. train said svms need use "sklearn", comes default anaconda. long story short, want blender (which runs python 3.4.2) use packages , modules present in anaconda installation (which runs python 3.4.3). i've tried variety of things following website: https://www.blender.org/api/blender_python_api_2_60_1/info_tips_and_tricks.html#bundled-python-extensions 1.) deleted "python" folder within blender.app. according above website, blender should fallback using version of python installed in system (i.e. 1 installed thru anaconda? right?) instead this: 2.) go onto option number 2. so, go anaconda folder , copy 2 folders "bin" , "lib" blender.app/contents/resources/2.76/python/ (replacing lib , bin folders there) so far good, open blender (no error) , write simple script: from sklearn import svm when try run followin

php - How to set time zones for different locations? -

i confused setting time zones. developing forum in php, in not sure displaying times replies. below condition, one question posted on 1 apr 2013 10.00 (time zone 'asia/calcutta'). replies on 31 mar 2013 11.30 pm because time zone of replied person 'america/chicago' -10.30 hours. my question how manage time zones different locations? in above example, should time displayed user has posted question , reply? and should time displayed user replied question? i using time function of php string insert time record in database. , display time used date("d m y h:m a", strtotime($time)); above code $time value comes database. thanks.. i store dates , times database using gmdate() make them gmt-based: $d = gmdate('y-m-d h:i:s'); // store $d database when render page, take account user's timezone preference: date_default_timezone_set('asia/singapore'); $ts = strtotime($date_from_db . ' gmt'); $date_on_page

asp.net mvc - How to display wrong username password on login form ? -

i developing mvc application. have designed login form. when user enters proper username , password then, redirect next page, when user put wrong username or password want display message on login form, how it. this code of method in controller... [httppost] public actionresult loginuser(formcollection oformcollection) { string username = oformcollection["username"]; string password = oformcollection["password"]; bool isaccountperson = false; var validemployee = (from e in db.employees e.username == username && e.password == password select e).tolist(); if (validemployee.count() == 1) { foreach (var v in validemployee) { oemployee = v; session["loggedemployee"] = oemployee; session["loggedem

c# - Sharepoint 2013 error when hosting site in IIS -

Image
i have custom web service, used execute workflow in sharepoint 2013. here part of code, works pretty when run web service in vs. workflowsubscription workflowsubscription = workflowmanager.getworkflowsubscriptionservice().getsubscription(new guid(properties.settings.default.spworkflowid)); dictionary<string, object> payload = new dictionary<string, object>(); payload.add("approvers", assignedtopo); payload.add("approversbn", assignedto); payload.add("approversgd", assignedtogd); worfklowservice.startworkflowonlistitem(workflowsubscription, convert.toint32(currentfileinsp.listitemallfields["id"]), payload); context.executequery(); enter code here after publishing web service iis workflow started show error messages. in english "the operation prohibited, because exceeds threshold value of list view, set admin". exact message in russian "Операция, попытка выполнить которую осуществляется, запрещена, п

error class 'django.contrib.auth.models.DoesNotExist -

i'm getting following error message not helpful , there no other error line... **(<class 'django.contrib.auth.models.doesnotexist'>)** this code (its ajax call) @login_required @csrf_exempt def smartpage_create_ajax(request): if request.post: try: json_dict = json.loads(request.post['site']) page = content() page.name = json_dict['name'] page.user(request.user) page.json = request.post['site'] page.save() return httpresponse('ok') except exception e: return httpresponse('%s (%s)' % (e.message, type(e))) could tell me means working before. thank you. update: class content(models.model): name = models.charfield(max_length=80, blank=true) logo = models.imagefield(upload_to="/logos", blank=true) json = models.textfield() objects = contentman

Is is possible to change dynamically the array expression of a PHP foreach loop? -

i have few arrays store pages configurations, have same indexes , other similar configurations. name followed config : $welcomeconfig = array ( "title" => "welcome website", "other_settings" ); $contactsconfig = array ( "title" => "contact us", "other_settings" ); since don't want hard code every page custom foreach loop wondered if possible define variable, concatenate config string , use array expression. i tried in way: $custom = "welcome"; $custom .= "config"; foreach ($custom $config) { echo $config; } but not work. is there way it? <?php $custom = "welcome"; $custom .= "config"; foreach ($$custom $config) { echo $config; } ?> http://php.net/manual/en/language.variables.variable.php

javascript - JS playing sound on IE -

i have simple code playing sound effect in js in onmouseover event. works this <script type="text/javascript"> var sonido=document.getelementbyid("neonclip"); </script> <audio preload id="neonclip"> <source src="http://www.mysite/neon.ogg" type="audio/ogg" /> </audio> and onmouseover bit: onmouseover="document.getelementbyid('neonclip').play();" problem works in firefox/opera/chrome not on ie, need work in major browsers. know problem sound file format, ie can't play .ogg. need add .mp3 maybe, how should it? adding if detecting browser in script?

javascript - Can the ternary operator be equivalent to short circuiting with the logical operators? -

with short circuiting can prevent evaluation of part of expression: let x = "", y = 123; x && alert("foo"); // "" y || alert("bar") // 123 since logical ops form expressions can use them in function invocations or return statements. but ultimately, that's nothing more conditional branching , can reached ternary operator: x ? alert("foo") : x; // "" y ? y : alert("bar"); // 123 this more readable , concise. there reason utilize short circuiting property of logical operators except illustrative term? it's true (well, true) that x ? x : y is logically equivalent to x || y however, they're not equivalent in terms of happens when code runs. in ? : case, sub-expression x may evaluated twice . in x || y , it's evaluated once. simple variable references, doesn't matter, if x function call, might affect behavior , it'll affect performance. (the fact 1 of expr

reactjs - setInterval within onClick in React -

update: new react(and js) , playing around it. want can click on image every 10 secs or something. how do it? not sure reset isclickable. i have this: var clickableimage = react.createclass({ getinitialstate: function(){ return { isclickable: false, counter: 0 }; }, componentdidmount: function(){ // componentdidmount called react when component // has been rendered on page. can set interval here: settimeout(() => { this.setstate({ isclickable: true, }); }, 1000); }, handleclick: function() { this.setstate({ counter: this.state.counter+1 }); }, render: function(){ var imgstyle = { width: '80%', height: '80%', backgroundcolor: "#4ecdc4" }; var counterstyle = { width: '80%', height: '80%', backgroundcolor: "#674172" }; const optionalonclick = this.state.isclickable ? { onclick:

c++ - Writing on last line with fstream -

i trying replace string in text file. replace() function. here code: #include <iostream> #include <fstream> #include <cstring> using namespace std; int main() { fstream file("c:\\users\\amir hossein\\desktop\\temp1\\test1.txt"); char *sub; sub = new char[20]; sub = "amir"; char *replace1; replace1 = new char[20]; replace1 = "reza"; char *buffer; buffer = new char[100]; int i, temp; streampos flag; int c=0,mark; bool flagforwrite=0; if (file.is_open()){ while (!file.eof()) { flag = file.tellg(); file.getline(buffer, 100); //we'll search sub inside of buffer, if true, we'll replace replace string flagforwrite=0; (i=0;buffer[i];i++){ mark=i; c=0; while (sub[c] && sub[c]== buffer[mark]){ c++; mark++; } if (!sub[c]){ //make changes in line (int j=i,count=0;count<strlen(replace1);j++,count++)

c - Why isn't it adding my numbers correctly -

i'm trying add 100 numbers in array code: numbers 17 117 should add lot more. #include <stdio.h> #include <stdlib.h> int main(){ int* number = malloc(101*sizeof(int)); int num = 0; while (num != 101){ number[num] = 17 + num; num = num + 1; }; num = 0; while(num != 101){ printf(" %d \n", number[num]); num = num + 1; } num = 0; int sum = 0; while (num != 101){ number[num] = 17; sum = sum + number[num]; num = num + 1; } printf(" %d \n ", sum ); return 0; } the bottom print statement gives me value of 1717 while (num != 101){ number[num] = 17; sum = sum + number[num]; remove second line has been resetting 17

java - How to customize spring webservice's PayloadValidatingInterceptor response message? -

i have java web service application built jaxb , spring webservice. i have complex type in xsd this: ... <complextype name="getrecordsrequest"> <sequence> <element name="maxrecords" type="int" maxoccurs="1" minoccurs="1"/> </sequence> </complextype> ... using xjc , had jaxb class generated xsd: public class getrecordsrequest { protected int maxrecords; public int getmaxrecords() { return maxrecords; } public void setmaxrecords(int value) { this.maxrecords = value; } } i used payloadvalidatinginterceptor in spring context.xml make sure user can't input besides integer maxrecords: <bean class="org.springframework.ws.server.endpoint.mapping.payloadrootannotationmethodendpointmapping"> <property name="interceptors"> <list> <ref local="validatinginterceptor" />

uiimageview - Android - Out of memory issue in S3 -

i developing android application have 7 sliders in 1 page. ie, 7 questions there , 1 slider corresponding each questions. users can answer question sliding pointer in each slider. in s3 page crashing. using high resolution images section. is due less heap size in s3? can resolve issue? there method on come issue? frame, need use images less-quality(it's not desirable)? use below method set image in imageview got this link worked me public bitmap shrinkbitmap(string file, int width, int height){ bitmapfactory.options bmpfactoryoptions = new bitmapfactory.options(); bmpfactoryoptions.injustdecodebounds = true; bitmap bitmap = bitmapfactory.decodefile(file, bmpfactoryoptions); int heightratio = (int)math.ceil(bmpfactoryoptions.outheight/(float)height); int widthratio = (int)math.ceil(bmpfactoryoptions.outwidth/(float)width); if (heightratio > 1 || widthratio > 1)

osx - Error installing Package in R Studio -

i trying install sdsfoundations package r studio in mac getting error. install.packages("~/downloads/sdsfoundations_1.3.tar", repos = null) error in install.packages : type == "both" cannot used 'repos = null' also tried following: install.packages("~/downloads/sdsfoundations_1.3.tar", repos = null, type ='binary') tar: failed set default locale any ideas? thanks

c# - ASP.Net MVC forms/model binding and delete records? -

i have model i'm loading table within form. records retrieved oracle db using ef6 , loaded model. want user able select records delete database via checkbox in each row in form. the function retrieve attendees: public list<webinarattendeeslist> getattendees(string webinarkey) { string connectionstring = "password=password;user id=user;data source=oracle"; list<webinarattendeeslist> r = null; using (webinarattendeeslistdbcontext context = new webinarattendeeslistdbcontext(connectionstring)) { var result = w in context.webinarattendeeslist w.webinarkey == webinarkey orderby w.firstpollcount, w.secondpollcount select w; r = result.tolist(); } return r; } here model: [table("webinarattendeeslist")] public class webinarattendeeslist { [key, column("wal_id")] public int wa_id { get; set; } [column("wal_cli_rid"

d3.js - Confuse about the overlap and collision between React and D3 -

all: i pretty new react, trying turn d3 data visualization chart react component, there 1 confuses: i not quite understand react's virtualdom, 1 thing believe d3 can not directly operation on it(only real dom can operated d3, right?), question is: how can take full advantage of react? if not true, show me code use both d3 , virtualdom make chart data updating operation , animation transition thanks you're correct d3 not operate on react's virtual dom, , d3 therefore not directly compatible react. unfortunate, there 2 ways around it. 1) make operate on virtual dom. react-faux-dom job of this, , makes lot of d3 work make sense in context of react. https://github.com/olical/react-faux-dom 2) use escape hatch, , manipulate dom directly. essentially, intercept new props in componentwillreceiveprops , set shouldcomponentupdate return false. there, take data componentwillrecieveprops , want dom refs d3 elements. neither case particularly beautiful. t

xslt: get attribute from xsl itself -

is possible read xsl attribute xsl document itself? need this: mystyle.xsl <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" id="i'm special stylesheet"> ... <!-- output should be: "stylesheet id: i'm special stylesheet" --> <xsl:text>stylesheet id:</xsl:text><xsl:value-of select="/@id"/> ... </xsl:stylesheet> is possible? yes, can use <xsl:value-of select="document('')/xsl:stylesheet/@id"/> , @ least long stylesheet has been loaded uri.

icalendar - How to add event in native IOS Calendar -

i want open native ios calendar(ical) application , add event. there way can open calendar particular event? i follow open iphone calendar app programmatically not yet succeeded. see calendar , reminders programming guide . basic process is: add eventkit.framework , eventkitui.framework project. (see linking library or framework .) import header: #import <eventkitui/eventkitui.h> if creating event, use : - (ibaction)didpresscreateeventbutton:(id)sender { ekeventstore *store = [[ekeventstore alloc] init]; if([store respondstoselector:@selector(requestaccesstoentitytype:completion:)]) { // ios 6 [store requestaccesstoentitytype:ekentitytypeevent completion:^(bool granted, nserror *error) { if (granted) { dispatch_async(dispatch_get_main_queue(), ^{ [s

java - Problems in removing records from database of jList -

hello have problem.. can give me snippet? have table of mysql display jlist item can add item can't remove database? while pressing remove item? i searched lot no 1 has ever need of doing.. wonder how possible? private void jbutton3actionperformed(java.awt.event.actionevent evt) { try { class.forname("com.mysql.jdbc.driver"); connection con= (connection) drivermanager.getconnection("jdbc:mysql://localhost:3306/test","root","ubuntu123"); preparedstatement stmt = null; resultset rs = null; string [] data; data = new string[100]; int i=0; defaultlistmodel listmodel = (defaultlistmodel) jlist2.getmodel(); int selectedindex = jlist2.getselectedindex(); if (selectedindex != -1) { listmodel.remove(selectedindex); string query = "delete supplierinfo companyname = ?

java - Access to non-static variable from static context -

this question has answer here: non-static variable cannot referenced static context 11 answers i trying access boolean variable stay class montyhall cannot because non-static , trying access in static context here code: public void updatestatistics(door door1, door door2, door door3) { this.numgames = this.numgames + 1; onedoor(door1, 0); onedoor(door2, 1); onedoor(door3, 2); if (montyhall.stay == true){ this.numstay = this.numstay + 1; } else{ this.numswitch = this.numswitch + 1; } } the variable stay located in class montyhall . appreciated confused how fix properties of class montyhall : public class montyhall { boolean stay; door = new door("a"); door b = new door("b"); door c = new door("c"); public montyhall(door a, door b, door c){ this.a = a; this.b = b;

dynamic jQuery selector not working, when id is concatenated -

the following selector working, var control = $('select[id^="control0"]')[0]; when use below selector, not working. var index = 0; var control = $('select[id^="control' + index + '"]')[0]; appreciate help. your code working me. need see html further. here's how tested code: ` var index = 0; var control = $('select[id^="control' + index + '"]')[0]; alert($(control).text()) <select id="control0"> <option value="1">1</option> </select> `

Headerdoc with delegate Protocols - Swift and xcode 7.2 -

Image
i have defined protocol , added headerdoc documentation method in protocol. appears correctly when option+click method: however, when option+click implementation within controller implements protocol, documentation not showing up: my expectation documentation wrote protocol show in controller, similar documentation apple: how protocol documentation visible elsewhere? if document protocol's method implementation within protocol extension, documentation visible within type conforms protocol. if omit extension's documentation, cando documentation protocol doesn't show anywhere else protocol itself, noticed. protocol doable { /// func cando() } extension doable { /// func cando() { print("did it!") } } struct task: doable { init() { cando() } }

Transferring from IE 10 to IE 11 in excel VBA -

i have code go website , log in. worked fine until yesterday, when got error 'run time error '429': activex object can't create object i checked, , somehow internet explorer gone programs. code: dim ie object dim strurl string dim objelement object sub login() ' add reference microsoft internet controls ' add reference microsoft html object library set ie = new shdocvw.internetexplorer ie.visible = true ie.navigate "https://minecraft.net/profile" while ie.busy doevents wend until not ie.busy , ie.readystate = 4 doevents loop ie.document.getelementbyid("username").value = "bobbybobwob" ie.document.getelementbyid("password").value = "ceylon878" dim htmlform htmlformelement set htmlform = ie.document.getelementbyid("loginform") htmlform.submit ' ********************************************************************** 'ie.document.getelementbyid("username").value = &quo

how to break chaining selectors in jquery -

i have doubts in break jquery chaining selectors . for example, consider sample code, <script> $("#button1, #button2, #button3, #button4, #button5, #button6 ").show(); </script> i want change format, <script> $("#button1, #button2, #button3, #button4, #button5, #button6 ").show(); </script> please help. in advance.. we pass string jquery selector function. difference in above 2 in first string formed , in second have concatenate otherwise error . can concatenate this, $("#button1, #button2, \ #button3, #button4, \ #button5, #button6 ").show(); or $("#button1, #button2,"+ "#button3, #button4, "+ "#button5, #button6 ").show(); you can assign common class buttons , use class selector show hide them. $('.button-class').show(); you can use attribute selector using wild card starts with if have patter

objective c - Getting directions via MapKit and location services -

i trying display directions user location destination. however, when initiate directions request error one: "the operation couldn’t completed. (mklocationerrordomain error 0.)" userinfo=0x7f9bc05b1a30 {nslocalizedrecoverysuggestion=turn on location services allow (null) determine location} now, evidently doesn't fact location services off. , since app never launched pop on requests permission makes sense. however, there way turn on location services using mapkit api ? must import cllocation that?

Migrating DTS packages to SQL Server 2016 -

i need migrate dts packages ms sql server 2016. contents of dts pacakages. there differences in sql statements insert, update, delete etc. things should aware of upgrade dts packages ssis? how can migrate dts packages sql server 2016? i not sure if microsoft provided migration wizard in sql 2016 migrate dts ssis know sure option in sql 2005 , 2008. best bet migrate ssis using sql 2005 or 2008 installation (use dts migration wizard). once packages in ssis 2005 or 2008 format easy upgrade them ssis 2016 format.... word of caution.... dts , ssis different , no upgrade wizard can full proof there lot of hand edits specially if have activex scripts in dts. if not code in dts opportunity re-write can learn ssis.

jsf - listener for <p:autocomplete> when an user clicks on an option -

i want navigate page when user clicks option dropdown menu of <p:autocomplete> , tried using onclick listener of <p:autocomplete> triggers whenever click on <p:autocomplete> textbox. there way achieve using javascript or using backing bean, listener should use required result? you may use ajax itemselect event <p:autocomplete ...> <p:ajax event="itemselect" listener="#{bean.handleselect}" /> </p:autocomplete> this call handleselect method in bean whenever item selected you may @ primefaces showcase

php - removing data from array -

i have problem need ignore array key if has "lastpost" set "no posts" this array dump of $sublast: array(3) { [0]=> array(9) { ["forum_category_id"]=> string(1) "3" ["name"]=> string(15) "sub category #1" ["description"]=> string(39) "this short description test.... #2" ["topics"]=> string(1) "0" ["lastpost"]=> string(8) "no posts" ["lastpostauthor"]=> string(1) " " ["lastposturl"]=> string(88) "http://test.codetrove.com/index.php?route=forum/read&forum_path=3&forum_post_id=" ["posts"]=> int(0) ["href"]=> string(81) "http://test.codetrove.com/index.php?route=forum/forum_category&forum_path=1_3" } [1]=> array(9) { ["forum_category_id"]=> string(1) "7" ["name"]=> string(16) "test sub sub cat" ["

C++ OpenGL Shaders errors -

#include <stdio.h> #include <stdlib.h> #include <string> #include <fstream> #include <gl\glew.h> #include <gl\freeglut.h> #include <glfw\glfw3.h> std::string loadfiletostring(const char* filepath) { std::string filedata; std::ifstream stream(filepath, std::ios::in); if (stream.is_open()) { std::string line = ""; while (getline(stream, line)) { filedata += "\n" + line; } stream.close(); } return filedata; } gluint loadshaders(const char* vertshaderpath, const char* fragshaderpath) { gluint vertshader = glcreateshader(gl_vertex_shader); gluint fragshader = glcreateshader(gl_fragment_shader); std::string vertshadersource = loadfiletostring(vertshaderpath); std::string fragshadersource = loadfiletostring(fragshaderpath); const char* rawvertshadersource = vertshadersource.c_str(); const char* rawfragshadersource = fragshadersource.c_str(); glshadersource(vertshader, 1, &rawvertshader

javascript - Creating a rank structure based on score without coding each possibility -

i trying code simple rank structure without coding each possibility. i want ranks 1-10 separated 25 point increments ( 0 points = level 1 though) than ranks 11-20 separated 50, 21-30 100 etc. increasing amount between levels double every 10 levels. i started bunch of if statements, , tried switch statements feel sloppy , waste of time , code. suggestions can point me right direction, not coding every possibility? i tagged javascript because coding in, more looking general direction/formula , can figure out code. to clear: 0-25 points = rank 1 26-50 points = rank 2 51-75 points = rank 3 etc... 201-225 points = rank 9 226-250 points = rank 10 etc.... 251-300 = rank 11 301 - 350 = rank 12 as can see once ranks 1-10 have delta of 25 points between ranks. ranks 11-20 have delta of 50 points between ranks, 21-30 should have 100 point delta between ranks etc. also trying remainder, know how far until next rank. if you're going repeatedly calculating rank

emacs 23 and 24 on osx: why does aquamacs-kill-word sometimes delete to end of line? -

this doesn't happen if start aquamacs without customizations. stepping through debugger first see transient-mark-mode true. set nil in .emacs file, , prefer if stayed nil, other code sets non-false value, causing kill region rather kill word. sometimes opt-d or opt-backspace deletes word, goes end or start of line respectively. comment out transient-mark-mode stuff out of code, i'd prefer either hook customize it, or way of globally saying never want region deleted unless select mark , point old-fashioned way , use kill-region delete it, or it's highlighted , can use cua-style way delete it. problem solved moving aquamacs emacsformacosx

r - Breaking down a timed sequence into episodes -

i'm trying break down vector of event times episodes. episode must meet 2 criteria. 1) consists of 3 or more events , 2) events have inter-event times of 25 time units or less. data organized in data frame shown below. so far, figured out can find difference between events diff(eventtime). creating logical vector corresponds events 2nd inter-event criterion, can use rle(episodetimecriterion) total number, , length of episodes. eventtime timedifferencebetweennextevent episodetimecriterion 25 na na 75 50 true 100 25 true 101 1 true 105 4 true 157 52 false 158 1 true 160 2 true 167 7

creating football news using PHP/mysql? -

please before downvotes read need answer , genuine question. i trying create website show football/soccer news on site. i wondering if there automated way of doing news published on site? example there site thats called football.co.uk show football news live , wondering how can that? i.e. show news , images etc? i creating website using php , mysql. i know can use rss feed sites bbc , skye don't think can images , rss feed can show title of news on site. need show title , when clicks on title, pointed news page on own website! i apologize if question bit vague have no other way of asking this. so appreciated. thanks what you're asking 2 separate questions: 1) grabbing latest news , results text website to automate news , results text website, you'll need find rss or xml provider such http://www.scorespro.com/livescore-xml/ 2) grabbing images match teams , scorers etc make content more engaging. for need find stock photo provider. automate

swift - Adding geojson layer to google map in iOS -

i writing first ios native app. trying load geojson layer onto google map in app (map comes google maps sdk) can't find way it. i'm proficient in google maps javascript api i'm sensing things in swift different. how can load geojson layer onto map in native ios app? as of today, have not see api can parse geojson google map shapes on ios. therefor have parse on own, parse array, loop through array each feature, each geometry, properties, , create shape based on feature type(point, line, polygon) here sample mapbox draw line, have extend point , polygon. // perform geojson parsing on background thread dispatch_queue_t backgroundqueue = dispatch_get_global_queue(dispatch_queue_priority_default, 0); dispatch_async(backgroundqueue, ^(void) { // path example.geojson in app's bundle nsstring *jsonpath = [[nsbundle mainbundle] pathforresource:@"example" oftype:@"geojson"]; // load , serialize geojson dictionary filled proper

python - __init__() missing 1 required positional argument: 'Value' -

i don't understand wrong. keep getting i'm missing required positional argument. class cointoss(object): def __init__(self, flip, id_num, value): self.flip = flip self.id_num = id_num self.value = value def flip(self): """ method important in determining number of flips , simulating coin """ data = [] num_flip = int(input("how many times want flip coin? :")) print("the ball @ start: ball: d%, state: d% value: d% " %(self.id_num)) in range(num_flip): self.flip = self.flip = 1 if randint(0,1) == 0: self.value = self.value + 1 data.append(self.value) else: self.value = self.value - 1 data.append(self.value) apparently, when use cointoss , call 2 arguments, flip , id_num . cause error, because did not provide cointoss.__init__()

image processing - gimp: histogram across multiple layers -

gimp has neat feature, histogram (windows -> dockable dialogs -> histogram). problem looks @ individual layers. i've playing around blending layers visualize computational operations, , i'd gauge final result visually through histogram. so far i've been generating histogram by merging layers , observing histogram merged layer, i'd see same histogram without merging layers - i.e., have histogram use data user seeing (as if layers merged), rather single layer. any way this? i found have histogram want on "visible" layer you can make appears using clicking right on top layer want see (the top layer?) , , click "new visible"

google apps script - Copying selected row to presentation -

my goal copy row spreadsheet , merge row data using markers document (ideally google presentation) saves pdf can print. i have figured out how have selected row copied object, can't life of me figure out how text copied kind of temporary document. have presentation template markers ready go. here of scripts i've been working with. function printrepairs() { var sheet = spreadsheetapp.getactivesheet(); var data = sheet.getdatarange().getvalues(); var row = sheet.getactiveselection(); //prints comma delim string of single row var row1 = data[1] logger.log("row #1: " + row1); var selectedrow = spreadsheetapp.getactiverange().getvalues(); // creates file selected row --doesn't work. browser.msgbox("the row selected contains: " +selectedrow); docslist.createfile('temp_row', selectedrow); copyblob(selectedrow); var folder = docslist.getfolder('temp'); folder.createfile('temp_row', 'hello',

html - Why the content in the span elements can't be put in the div container? -

Image
the content in p elements can put in div container following css codes. * { margin: 0 0 0 0; padding: 0 0 0 0 } div.container { width: 400px; height: 121px; border: 1px solid red; position: absolute; bottom: 0px; left: 0px; right: 0px; top: 0px; margin: auto; } div.box { float: left; } div img { margin: 0px; padding: 0; width: 121px; height: 121px; float: left; } div.description { float: left; border 1px solid red; margin: 10px 50px; } <div class="container"> <div class="box"> <img src="images/set06.jpg" /> </div> <div class="description"> <p>music mane: xxxxxxxx</p> <p>author: yyyyyyyy</p> <p>publication:20081001</p> <p>language:english</p&g

java - Math done in a 10x10 two dimensional array does not compute correctly -

i set 2 dimensional array, 10 10, , each slot (x*y) respective position. i'm trying add numbers in columns 3, 5, , 7 ctotal , add numbers in rows 2, 4, , 6 rtotal. coding seems sound can't seem make work. ideas? public static void arraymath() { int ctotal = 0; int rtotal = 0; //int tdiffvalue = (rtotal - ctotal); int twodimarr[][] = new int[10][10]; int row = 10; int col = 10; int x = 0; int y = 0; for(x = 0; x < row; x++) { for(y = 0; y < col; y++) { twodimarr[x][y] = x*y; } } for(x = 0; x < row; x++) { for(y = 0; y < col; y++) { if( (x+y) < col ) { //system.out.print( " " ); } //system.out.print(" " + (twodimarr[x][y])); } //system.out.println(); } for(x = 0; x < twodimarr.length; x++) //problems start down here. { for( y= 0; y<twodimarr

php - passing values to sql through check boxes and dropdowns -

Image
how can pass drop down values sql database , check box example if user selects english , maths value inserted in database 1 or else value 0 <form> <p id="p1">select year</p> <select id="year_sel"> <option value="blank"></option> <option id="primary" value="primary">primary</option> <option value="1">year one</option> <option value="2">year two</option> <option value="3">year three</option> </select> <input type="checkbox" name="math" value="math">math<br> <input type="checkbox" name="english" value="english">english<br> <input type="checkbox" name=&q

android - Sync SQLite with homemade Linux server -

i'm learning android , want know how can make app gets values sqlite in homemade linux server (with raspberry pi , want test, not publish app, , save values in device , if in device value changed has changed in server too. it depends on ip configuration, since sql have connection ip adress, have on local network using local ip of linux server, otherwise, public connection must have static public ip server, can buying internet provider (not recommended) or instead can buy space in online server, can use phpmyadmin or sql administrator can edit via ftp , give ip or dns public connection.

angular - Inject Router using Injector.resolveAndCreate inside a class -

is possible inject router using injector.resolveandcreate() ? import {exceptionhandler, injectable, inject,injector} 'angular2/core'; import {router,router_primary_component} 'angular2/router'; @injectable() export class myexceptionhandler implements exceptionhandler{ constructor(public router: router) { } call(error, stacktrace = null, reason = null) { console.log("error >> " + error); console.log("stacktrace >> " + stacktrace); console.log("reason >> " + reason); let injector: = injector.resolveandcreate([router]); let router: router = injector.get(router); router.navigatebyurl('/error'); } } getting exception: error during instantiation of token routerprimarycomponent! (e -> router -> routeregistry -> token routerprimarycomponent). sure, if use injector has router_providers register