Posts

Showing posts from February, 2014

php - codeiginiter always shows 404 error ubuntu 14.04 -

i done project using codeiginiter in windows(xampp), changed os ubuntu 14.04 , have installed lamp , lamp works fine. i copied project files /var/www/html , changed configurations ububtu $config['base_url'] = 'http://localhost/lankaproperty/'; $config['index_page'] = 'index.php'; routes $route['default_controller'] = 'welcome'; $route['404_override'] = 'home/error_404'; $route['500_override'] = 'home/error_500'; $route['translate_uri_dashes'] = false; .htaccess rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule .* index.php?/$0 [pt,l] i have changed file permissions 755.. when try default controller http://localhost/lankaproperty/ works fine.. but none of other controller working http://localhost/lankaproperty/home http://localhost/lankaproperty/index.php?/home i error. ` 404 page not found the page requested no

javascript - Detect if the Printer Had Successfully Print the Page -

i printing site page using code below: window.print(); how know if page successfully/not successfuly printed printer? reason why want "to avoid reprinting page twice". each successful print quite expensive in case because printing id. i looking browser compatible solution. thank you. can't :/ there window.onafterprint handler, fired both when user prints or aborts print dialog. , not implemented too. p. s. don't see why want know whether print took place or not.

java - LibGDX CPU Rendering -

we made game not physics based , not resource heavy. in it's menu simple animation going , on devices it's slow. on devices quad core cpus runs slower cpus example dual core 1.2ghz it's slow.there no calculations can take cpu usage. think caused cpu rendering because when run game "show gpu view updates" option developer options nothing highlights. how render gpu in libgdx or problem? cpu rendering can vary in performance in large extent due different levels of optimizations available , different architectures , instruction sets on different platforms. even then, if game not resource heavy, cpu rendering can acceptable. if providing less performance need, you should profile code . that way know optimization required. if profiling leads conclusion cpu rendering actual bottleneck, , migrate gpu, libgdx best way go. adequately documented , there many blogs, books may find resourceful. blogs 3d books references

javascript - Tag <a> lose its background after page reloads -

i'm trying assign background elements javascript, tags keep background during page reloading, switching normal background. here code: javascript: $(document).ready(function(){ $(".container_menu ul li a").click(function() { $(this).addclass("active").siblings().removeclass("active"); }); }); css: .container_menu ul li a.active{ background-color: rgba(255, 255, 255, 0.156863); } html: <ul> <li><a class="" href="user">home</a></li> <li><a class="" href="user/gallery">gallery</a></li> <li><a class="" href="user/about">about autor</a></li> <li><a class="" href="user/login">manage</a></li> </ul> thanks your javascript code altering page after has been loaded. when reload page, goes initial state. what trying

php - display duplicates according to count? -

i have 2 tables books , bkdates want duplicates according count books id|name|edno 1|book1|1 2|book2|2 3|book1|1 4|book2|2 5|book1|1 6|book3|3 bkdates edno|year 1|1980 2|1990 1|1980 1|1988 2|1991 2|1990 1|1980 3|2003 expected output edno|year|count 1|1980|3 1|1988|1 2|1990|2 2|1991|1 help??! select edno, year, count(edno) bkdates group year

Rounding values in a dataframe in R -

this question has answer here: rounding numbers in r specified number of digits 2 answers i have dataframe values shown below january february march 0.02345 0.03456 0.04567 0.05432 0.06543 0.07654 i need command round each of these values 3 decimal points. output should shown below january february march 0.023 0.035 0.046 0.054 0.065 0.077 in case data frame contains non-numeric characters may willing make use of function jeromy anglim : round_df <- function(x, digits) { # round numeric variables # x: data frame # digits: number of digits round numeric_columns <- sapply(x, mode) == 'numeric' x[numeric_columns] <- round(x[numeric_columns], digits) x } round_df(data, 3) i think it's neat , quick approach handle rounding problem across heterogeneous data frames.

bash - How to count the number of appearances of a word in each line -

i have text file , count each line number of appearances of given word example if word "text" , file abc text fff text text jjj fff fff text ddd eee rrr ttt yyy i expect output 3 1 0 how can achieve bash? while read line; echo "$line" |tr ' ' '\n' |grep text -c ; done < file

java - Spray scala building non blocking servlet -

i've builded scala application using spray akka actor. my problem request synchronized , server can't manage many requests @ once. is normal behaviour? can avoid this? this boot code: object boot extends app configuration { // create actor system application implicit val system = actorsystem("my-service") //context.actorof(roundrobinpool(5).props(props[testactor]), "router") // create , start property service actor val restservice = system.actorof(props[restserviceactor], "my-endpoint") // start http server property service actor handler io(http) ! http.bind(restservice, servicehost, serviceport) } actor code: class restserviceactor extends actor restservice { implicit def actorreffactory = context def receive = runroute(rest) } trait restservice extends httpservice slf4jlogging{ val mydao = new mydao val accesscontrolallowall = httpheaders.rawheader( "access-contr

javascript - Angularjs $http.get does not work -

my purpose consume rest web service in angularjs , making trials right now. below code not working , throwing following exception. can me identifty problem? thanks in advance. function getusersfromlocal($scope,$http) { $http.get('http://localhost:8080/people'). success(function(data) { $scope.data = data; }); return data; } error is: typeerror: cannot read property 'get' of undefined @ getusersfromlocal. the service accessible , tested through rest clients. if understood correctly getusersfromlocal function inside controller, function parameters killing $scope , $http object existence, need remove them parameter & removed return statement outside $http won't work in anyways. code app.controller('mainctrl', function() { $scope.getusersfromlocal = function() { $http.get('http://localhost:8080/people'). success(function(data) { $scope.data = data; }); }; $scope.get

jquery - Backbone from NPM via JSPM -

i'm trying install backbone.marionette npm jspm client dependency resolving. simple operation following command in commandprompt: jspm install marionette=npm:backbone.marionette all dependencies - except jquery automatically downloaded , installed. runtime error: 'can't call deferred of undefined'. looking code, , found problem in backbone source code line 9, 10 , 11 } else if (typeof exports !== 'undefined') { var _ = require("underscore"); factory(root, exports, _); when running under traceurjs, factory-method called here, , clear, last argument $, left out. when in backbone sourcecode on github, same lines this: } else if (typeof exports !== 'undefined') { var _ = require('underscore'), $; try { $ = require('jquery'); } catch(e) {} factory(root, exports, _, $); here jquery dependency added option (try/catch). have add here, npm version marked same version github - 1.1.2. why difference? seems if has b

sqlite - Alarm Code in java using Netbeans IDE -

hi guys first of must of guys helping me :). silent member before query , benefited lot other members question. but i'm stuck in code. see i'm developing software event management. have done basics of creating , saving events in database - i'm using sqlite db. i'm stuck code of pop-up , alarm when event time started. i saved date string in db in format "26-04-2015". saved time string in db in format "17:00:00". what i've tried uptil - comparing current time on db failed make work) any suggestion or highly appreciated. private void checkalarm() { new thread() { calendar cal = new gregoriancalendar(); int hour = cal.get(calendar.hour); int min = cal.get(calendar.minute); int sec = cal.get(calendar.second); string time = hour + ":" + min + ":" + sec; string[] data = connect.readdata1("select e_sdate, e_stime,e_title tbl_event order e_sdate asc limit 1&qu

javascript - How can I find current element text on mouseover using jquery -

this code, <!doctype html> <html> <body> <svg id="a" height="210" width="400"> <path id="b" d="m150 0 l75 200 l225 200 z" /> </svg> </body> </html> when mouse on b, want code (path id="b" d="m150 0 l75 200 l225 200 z" ).how can using jquery? you can use outerhtml : var path = $("#b")[0].outerhtml; // <path id="b" d="m150 0 l75 200 l225 200 z"></path> then combine hover: $("#b").hover(function() { console.log($(this)[0].outerhtml); }); working example as pointed out, won't work in ie because doesn't follow specification . can workaround cloning <path> element, appending html body make part of dom, grabbing rendered html there. note: won't exact representation of html because it's out of context. example, contains xmlns , since it's jquery object can modify

scala - standalone spark: worker didn't show up -

Image
i have 2 question want know: this code: object hi { def main (args: array[string]) { println("sucess") val conf = new sparkconf().setappname("hi").setmaster("local") val sc = new sparkcontext(conf) val textfile = sc.textfile("src/main/scala/source.txt") val rows = textfile.map { line => val fields = line.split("::") (fields(0), fields(1).toint) } val x = rows.map{case (range , ratednum) => range}.collect.mkstring("::") val y = rows.map{case (range , ratednum) => ratednum}.collect.mkstring("::") println(x) println(y) println("sucess2") } } here of resault : 15/04/26 16:49:57 info utils: started service 'sparkui' on port 4040. 15/04/26 16:49:57 info sparkui: started sparkui @ http://192.168.1.105:4040 15/04/26 16:49:57 info executor: starting executor id <driver> on host localhost 15/04/26 16:49:57 info akkautils:

c++ - Gsoap compilation -

i trying write simple hello world gsoap sample. have included http_get plugin also. when compile using : g++ restservice.cpp soapc.cpp soaprestservicesoap12service.cpp -o server.exe -lgsoap++ i follwing errors : soaprestservicesoap12service.cpp:(.text+0x0): multiple definition of `soap_encode_string' /tmp/cci3th4n.o:restservice.cpp:(.text+0x0): first defined here /tmp/cc9vrcvb.o: in function `soap_decode_string': soaprestservicesoap12service.cpp:(.text+0x138): multiple definition of `soap_decode_string' /tmp/cci3th4n.o:restservice.cpp:(.text+0x138): first defined here /tmp/cc9vrcvb.o: in function `http_get': soaprestservicesoap12service.cpp:(.text+0x162c): multiple definition of `http_get' /tmp/cci3th4n.o:restservice.cpp:(.text+0x5fe): first defined here /tmp/cc9vrcvb.o: in function `query_val': soaprestservicesoap12service.cpp:(.text+0x141a): multiple definition of `query_val' /tmp/cci3th4n.o:restservice.cpp:(.text+0x3ec): first defined here

Getters, Setters , Object Java -

i'm not sure wrong code. code person class shown below. i have no idea start main method, object person class instantiated this: newperson = new person( "richard pelletier", "1313 park blvd", "san diego, ca 92101", "(619) 388-3113" ); person: public class person { private string name; private string address; private string citystatezip; private string phone; public person(){} public person( string name, string address, string phone ) { this.name = name; this.address = address; this.phone = phone; } public void setname( string name ) { this.name = name; } public void setaddress( string address ) { this.address = address; } public void setphone( string phone )

android - Creating a custom widget with a group of existing widgets? -

i've looked around on how i'm still not sure, i've decided ask here. i'm looking create list of widgets display artist names, genre, , venue playing at. below picture of 4 widgets consisting of imageview , 3 plain textviews want somehow group , create 1 custom widget, 4 components can call to, display relevant information. i'm looking have widget duplicate set limit, displaying different artists, genre, , venue 1 below other. i'm quite stuck on how approach this, , great please! in advance! image: http://puu.sh/hr9x4/b3bffdf263.jpg edit: bump! appreciated! create custom view. create class widget , extent linear layout. in constructor inflate layout containing layout(image view , 3 text views). add inflated view class calling addview write setter functions in accept object of event class contains information related event , function set values appropriate text view. class widget extends linearlayout{ private textview artistname; p

AngularJS : how to reflect a variable change in one directive into another directive while using ng-repeat -

in first case : implemented directive directive2 change bar value reflected in directive1 . here u can find plunkr (1st case) in second case :i implemented directive directive2 , ng-repeat used along directive changes bar value , supposed reflected in directive1 . here u can find plunkr directive2 ng-repeat (2nd case) how expect work : want bar in directive1 change according change in directive2 my question: 1st case working way want. in 2nd case bar value in directive1 not changing according changes made in directive2 . my assumption using ng-repeat creating multiple scopes , hence not working way want. how solve this? html snippet (2nd case) <body ng-controller="mainctrl"> directive1: <directive1></directive1> <br /> <div ng-repeat="item in [1,2]"> directive2 ng-repeat {{item}} <directive2 bar="bar"></directive2> </div> </body> js snip

c - Append to linked list not working? -

i trying make round robin scheduling simulator in c. made program reads input file , stores of processes info array. put info array of "jobs". made counter function increases time , checks if of jobs arrival times time. if gets inserted "ready queue" linked list. , increases waiting time of in linked list. then made function round robin. gets head, , calls counter function twice. removes head , puts end of list. think there problem here. process 3 somehow ending before process 7. i using command line arguments so: ./a.out input.dat text.txt 5 0.4 and input.dat follows: 1 0 10 3 2 2 0 4 3 3 20 5 4 4 7 3 5 5 10 5 6 6 0 4 7 7 20 5 8 9 7 3 9 10 10 5 10 12 0 4 here necessary part of code: #include <stdio.h> #include <stdlib.h> #include <string.h> #define n 10 char *crr;//get argument rr time char *calpha;//get argument alpha int full[40]; int arraylength; int rr;//to hold rr time int int i=0;//used count amount of nu

c# - Unable to cast object of type System.Web.UI.WebControls.Label to type System.IConvertible -

this gridview code <asp:gridview id="gvwsearch" runat="server" autogeneratecolumns="false" backcolor="white" bordercolor="#999999" borderstyle="solid" borderwidth="1px" cellpadding="3" datasourceid="searchsqldatasource" forecolor="black" gridlines="vertical" width="100%" visible="false" allowsorting="true" allowpaging="true" onselectedindexchanged="gvwsearch_selectedindexchanged" onpageindexchanging="gvwsearch_pageindexchanging"> <alternatingrowstyle backcolor="#cccccc" /> <columns> <asp:templatefield> <itemtemplate> <asp:linkbutton id="lnkbtnedit" runat="server" onclick="lnkbtnedit_click"> edit</asp:l

java - MySQL query correct syntax is not working in JdbcTemplate -

i'm using like keyword query form table single search parameter. when run following sql statement in mysql workbench, it's working expected. set @search = 'b'; select t.*,d.divisionname township t inner join division d on t.divisionid=d.divisionid t.townshipcode concat('%', @search, '%') or t.townshipname concat('%', @search, '%') or d.divisionname concat('%', @search, '%') order t.townshipcode limit 0,10 but, when execute form java code jdbctemplate , got badsqlgrammarexception . following java code : public list<township> getlist(integer pagenumber, integer pagedisplaylength, string searchparameter) { int start = ((pagenumber - 1) * pagedisplaylength); string query = ""; if (null != searchparameter && !searchparameter.equals("")){ query = "set @search = '" + searchparameter + "'; " + "select t.*,d.divi

ios - dismissViewControllerAnimated not being called on iPhone -

i have following code trying show pdf preview. words on ipad when trying on iphone dosnt work. qlpreviewcontroller* preview = [[qlpreviewcontroller alloc] init]; preview.datasource = self; [self dismissviewcontrolleranimated:yes completion:^{ [self presentviewcontroller:preview animated:yes completion:nil]; }]; the thread on iphone never makes line [self presentviewcontroller:preview animated:yes completion:nil]; but works fine on ipad.. not sure at. appreaciated. to access instances/variables (that declared outside of block) inside block, need declare instances/variables this: __block type identifier = initial value (optional) e.g, in case use __block qlpreviewcontroller* preview = [[qlpreviewcontroller alloc] init];

regex - How to strip and get the code between two lines in PHP? -

i'm trying assign variable in php, regex , preg_replace i've tried doesn't me. here sample text. claim code: 7241b-2hwrxr9-2p2ba $1.00 i want pull out in middle, 7241b-2hwrxr9-2p2ba . you can use following match: claim code:\s*([\w-]+)\s*\$(\d+(?:\.\d+)?) and can pull out whatt want $1 see demo

android - Sending Email with mp4 attachment does not work -

i use following code send email mp4 attachment: intent email = new intent(intent.action_send); email.settype("*/mp4"); email.putextra(intent.extra_email, new string[]{to}); email.putextra(intent.extra_subject, subject); email.putextra(intent.extra_text, message); file f = new file(record[ipos]); uri uri = uri.fromfile(f); email.putextra(intent.extra_stream, uri); startactivity(intent.createchooser(email, "select email client")); the values of f , uri equals: f = {java.io.file@830047473992} "data/data/com.example.bernard.speechparole/files/5-auth.mp4" uri = {android.net.uri$hierarchicaluri@830047488248} "file:///data/data/com.example.bernard.speechparole/files/5-auth.mp4" i select yahoo client: shows in client (yahoo) right file attached file size. works fine, never receive email (i've checked spam folder). when send email w

ruby - Linear Search not completing successfully -

performing basic linear search loop on array, , not returning expected value. given: students = ["alex", "kyle", "libby", "monkey boy"] i'm trying basic linear search see if name "monkey boy" exists, , return it's index. def linear_search(array, name) = 0 while < array.length if array[i] == "#{name}" return else return -1 end i+=1 end end linear_search(students, "alex") # returns 0 linear_search(students, "monkey boy") # returns -1, should return 3 very confused. what's going on here? your while block incorrect if def linear_search(array, name) = 0 while < array.length if array[i] == "#{name}" return else return -1 end i+=1 end end when search linear_search(students, "alex") "alex" present @ array[0], , array[i] == "#{name}" true return , breaks loop when search linear

java - ServerSocket connecting to itself more than once -

question: can computer, acts server, connect more once socket? background: i'm designing game java class involves networking. far in code, have 1 computer host game via serversocket while computer connects via socket. debugging purposes, have been hosting server , connecting server on same computer. make serversocket on port 3333 instance, create socket connecting port 3333; , on same machine , ip address. however, have noticed anytime try make more 1 socket connection on same machine, 2 sockets both connect same serversocket on same machine, previous socket connection closed. why that? reason doing way make life simpler when comes code; way, can make host act client , reuse code instead of implementing new 1 client host-sided. question: can computer, acts server, connect more once socket? yes. long accepting side implemented normally, i.e. handle multiple clients, computer doesn't care clients coming from.

loops - Why is this variable not considered a constant? -

the following code wrote test bench simulate decoder (verilog hdl). converts [15:0]ir [25:0]controlword . literal byproduct watched well. all values 0-65535 need tested 16-bit ir variable. in beginning of loop, distinctly assign ir 0, quartus telling me that: warning (10855): verilog hdl warning @ controluni_tb.v(20): initial value variable ir should constant and result following: error (10119): verilog hdl loop statement error @ controluni_tb.v(23): loop non-constant loop condition must terminate within 250 iterations the code test bench module follows: module controluni_tb; reg [15:0]ir; reg clock; wire [25:0]controlword; wire [15:0] literal; total_control_unit_2 dut (ir,controlword,literal); initial begin clock <= 1'b0; end initial begin ir <= 16'b0; end initial begin forever begin #1 ir <= ir + 16'b1; end end initial #65535 $finish; endmodule your code has no er

Adding a file to Google Drive through Google Scripts -

in standalone google script, have made created google sheet using api, using it's spreadsheetapp.create() function, , filled spreadsheet data. i have add file google drive, have no idea how. i'm assuming create() method doesn't add drive automatically. thanks! when use spreadsheetapp.create() creates new spreadsheet natively (and obviously) in drive. there no need add drive , doesn't make sense. can check small code : function testcreate(){ var newss = spreadsheetapp.create("new test spreadsheet"); browser.msgbox("file in drive "+driveapp.getfilebyid(newss.getid()).getname()); } note : run spreadsheet (any spreadsheet) because uses browser.msgbox( ) method works in spreadsheets.

java - If else statement fails -

for (h = 1; h <= userinput; h++) { while (h <= userinput) { system.out.println("\npick y coordinate: (1 - " + row + ")"); try { userinput2 = stdin.nextint(); if (userinput2 > 0 && userinput2 <= row) { } else { system.out.println("make sure choose a" + " coordinate between 1 , " + row); } } catch (exception f) { system.out.println("make sure choosing coordinate" + " between 1 , " + row); stdin.next(); continue; } system.out.println("\npick x coordinate: (1 - " + column + ")"); try { userinput3 = stdin.nextint(); if (userinput3 > 0 && userinput3 <= column) { } else { system.out.println("make sure choose a"

Is it possible to replace android's browser default copy paste on text? -

i wondering if replace android's browser default copy paste on text. in which, user can long touch text , toolbar display button of copy or paste. wanted is, whenever user long touch text, app popup menu under selected text , button of copy , paste. if user click on copy, save text file or sqlite future reference. that, copied item won't lost. you need write onlongclicklistener element in text resides want copied/pasted. example: mytextview.setonlongclicklistener(listener);

set value of input field by type and placeholder name from javascript table jquery -

i have table dynamically generated bootstrap , contains search field filter results. input search field generated such html <input class="form-control" type="text" placeholder="search" > jquery $(document).ready(function() { $('input[type="text"][placeholder="search"]').val("test"); }); i tried adding form-control , did not work well. $('input[class="form-control"][type="text"][placeholder="search"]').val("test"); this jfiddle works should, suspecting dynamic loading of search field bootstrap table not catching it. after looking @ github source code here: https://github.com/wenzhixin/bootstrap-table/blob/master/src/bootstrap-table.js , found line 836 interesting, seems triggering search update on search text box keyup event so... settimeout(function() { $('input[type="text"][placeholder="search"]')

How can I stop an AngularJS $interval? -

i have code inside function gets called every 1 or 2 minutes. counts down 60 0 (i've set 60 maximum number of iterations). var timer = $interval( function (times: number) { var retry = 60 - times; $scope.retrymessage = "retry + " seconds"; }, 1000, 60); from can see documentation suggesting $interval must cancelled when can this? assume cannot add: $interval.cancel(timer); after code. $interval returns promise. can cancel this var times = 60; var promise = $interval( function () { var retry = 60 - (times++); $scope.retrymessage = retry + " seconds"; if(retry == 30){ //cancel in 30 seconds instead .. reason $interval.cancel(promise); } }, 1000, 60);

Monte-Carlo: R script not returning anything -

my r script is mcnorm.r <- function(m,n) { library("mvtnorm", lib.loc="~/r/win-library/3.2") r <- as.matrix(read.csv("data.csv", header=false)) mu <- colmeans(r) sigma <- cov(r) r <- array(0,dim=c(m,ncol(r),n)) for(n in 1:n) { r[,,n] <- rmvnorm(m,mu,sigma) } } it monte-carlo simulation of n matrices of multivariate-normal data of sample size m, dimension determined data set. but when call > data <- mcnorm.r(12,10) i data empty. why isn't code returning anything? edit : defining global variable including r <<- r before last curly bracket seems work. it doesn't return because don't give function value return. you assign bunch of stuff local variable, function doesn't know return it. you either need have unassigned expression @ end of function (which value of function), or explicitly use return . contrast these 2 functions: f1=function(x) x+1 # returns value f2=f

php - How to join several mp3s (wavs) on server? -

i'm looking possibility join several audio files in 1 on server. example: audio_01.mp3 / 33sec + audio_02.mp3 / 22sec = audio_03.mp3 / 55sec server - linux based, main language php (just in case) could please point me in right direction? thanks in advance! using ffmpeg this concatenate 2 mp3 files, , resulting metadata of first file: ffmpeg -i "concat:file1.mp3|file2.mp3" -acodec copy output.mp3 this because, ffmpeg, whole "concat:" part single "input file", , metadata of first concatenated file. if want use metadata second file instead, have add dummy input file , map metadata of output: ffmpeg -i "concat:file1.mp3|file2.mp3" -i file2.mp3 -acodec copy test.mp3 -map_metadata 0:1 if want construct metadata 2 metadatas, you'll have hand. can dump file's metadata with ffmpeg -i file1.mp3 -f ffmetadata file1.metadata after dumping both metadatas , constructing new metadata, can add output file -metadata

flash - Why are my external resources not being loaded (in many cases) via URL/Loaders in ActionScript? -

i developing flash game, loads resources local url. url resolved locally , http://example.dev . holds static resources, http://example.dev/images/randomtiles/grass.png is, actually, valid image if hit resource via curl . however, i'm using 2 browsers test. 1 google chrome adobe flash player 15.0.0.189, , 1 firefox adobe flash player 11.2.202.457. i'm using ubuntu 14.04 (perhaps bug , not 8-layer issue). in afp 15, hitting url http://example.dev/images/randomtiles/grass.png not work @ all. in afp 11, hitting url http://example.dev/images/randomtiles/grass.png works if connected internet. hitting url curl works always. hitting url chrome or firefox directly, works always. the mechanism used hit images via flash bit long explain, based in loaders: var loader:loader = new loader(); loader.contentloaderinfo.addeventlistener(event.complete, function(e:event):void { try { addcachecallback(entry, bitmap(loaderinfo(e.target).content)); } catch(e:error) {

c++ - linkedlist, cannot link the node to head -

i lost direction in middle of somewhere, cannot figure out wrong code. functions below append function put node list. void appendnode(struct s_list *list, unsigned int data) { if (list == nullptr) return; struct s_node *temphead = list->head; struct s_node *newnode = new s_node; newnode->next = nullptr; while (temphead != nullptr) temphead = temphead->next; temphead = newnode; } i'm calling function 100 times , won't link new node current list @ all. shouldn't hard find problem i'm bad. give me advice. thanks. //*************************************************************************// thanks reply still have same problem. allocate head node list pass function. now, changed pass head of list directly, not list anymore still have same issue... void appendnode(struct s_node *head, unsigned int data) { if (head == nullptr) return; struct s_node *temphead = head; struct s_node *newnode =

java - Android web socket set server end point -

i use socket connect "iphere:8080/chat/" iphere being replaced real endpoint ip. whenever use private static final int serverport = 8080; private static final string server_ip = "iphere/chat/"; socket socket = new socket(server_ip, serverport); i received error message : 04-25 22:38:37.745 12521-12959/com.package.slidingtabs w/system.err﹕ java.net.unknownhostexception: unable resolve host "iphere/chat/": no address associated hostname

angularjs - Filtering Rails output with angular filters -

i kind of new towards implementing rails angular js. want have listing index page gives me listings using listing.all my page has several filters in it.lets have filter of gender, needed when dropdown changes page listings in should refreshed , show listings selected gender. here have done:- / application.js / //= require jquery //= require jquery_ujs //= require semantic-ui //= require dropzone //= require cloudinary //= require angular //= require angular-resource //= require app.js //= require_tree ./angular //= require_tree . / listingcontroller(rails) / def index @listings=listing.all end / index.html.erb / <%=select(:listing,:gender,options_for_select([['male','male',{class:'item'}],['female','female',{class:'item'}]]),{prompt:'gender'},{:'ng-model'=>'listing.gender',class:'ui dropdown gender'})%> <div class="ui divided items" ng-controller="listing

javascript - Will Google Analytics have any problems if I use it on User Restricted pages -

looking @ javascript use, seems there should not issues. looks if pushing simple data google. wondering if there should think when using google analytics on user restricted asp.net mvc pages, or restricted page matter. i'm thinking of tracking regular users vs admin users, of use separate pages, load 1 google analytics script on depending on user role. you can still use google analytics on pages.

html - How do I retrieve a td value in PHP based on the row of the submit button pressed? -

Image
i being able see td value based on row 'submit' button in. here html code <?php foreach($books $booklist) : ?> <tr> <form action = "." method = "post"> <input type="hidden" name="action" value="addtocart" > <td><img height="50" width="50" src=<?php echo "/../../product_manager/uploads/".$booklist['productimage']; ?>></td> <td><?php echo $booklist['name']; ?></td> <td><?php echo $booklist['version']; ?></td> <td><?php echo $booklist['releasedate']; ?></td> <td><?php echo $booklist['price']; ?></td> <td><?php echo $booklist['quantity']; ?></td> <td><input name="submit"

Can ANYONE add a service reference to my web service? -

im new working web services, if create web service in visual studio deploy it, can't finds link add service reference , use it? yes. that's why should secure web services should not available public. many web services use api key and/or password secure access. can restrict access specific ip addresses, depending on situation.

python - iterate over model field names django -

i looking create 2 models one-to-one-field, first nothing more t/f, second corresponds fields of first. if first class has true, second class takes field, such if class 1.text == true next class have class2.text set "hi, field text" whereas if class1.text false, class2.text empty string. i implement form save second class depending on fields first has set true, iterate on field names, in if class 1 is: class data(models.model): fields= onetoonefield(data2) text = booleanfield email = booleanfield and class 2 is: class data2(models.model): text = booleanfield email = booleanfield i want set field names class1 variables, , relate them that. in template: {% field in data %} {% if data.field == true %} {{ data2.field }} {% endif %} {% endfor %} if makes sense. how accomplish this, or there easier way relate identically named fields 2 models?

sprite kit - Swift: skaction not executed after contact between nodes is made? -

alright, have contact detection set between 2 nodes - savior , chicken1 . set here: //this within gamescene class var screentouches = bool() enum collidertype:uint32 { case savior = 1 case chicken1 = 2 } savior.physicsbody?.categorybitmask = collidertype.savior.toraw() savior.physicsbody?.contacttestbitmask = collidertype.chicken1.toraw() savior.physicsbody?.collisionbitmask = collidertype.chicken1.toraw() chicken1.physicsbody?.categorybitmask = collidertype.chicken1.toraw() chicken1.physicsbody?.contacttestbitmask = collidertype.savior.toraw() chicken1.physicsbody?.collisionbitmask = collidertype.savior.toraw() //this outside of gamescene class //collision detection func didbegincontact(contact: skphysicscontact) { if (contact.bodya.categorybitmask == collidertype.savior.toraw() && contact.bodyb.categorybitmask == collidertype.chicken1.toraw() ) { chicken1.hidden = true

jquery - Rails - render JavaScript with AJAX or redirect -

i have rails remote form_for . several reasons way better idea use ajax submit form's contents. if there errors saving form want able render .js.erb file page updates error div partial displays errors. if there no errors want able redirect , display flash message. is possible? you can try in controller method: if @code flash[:success] = 'success message' render js: "window.location = '#{path}'" else flash.now[:alert] = @instance.errors.full_messages render partial: 'your/partial' end detailed explanation: @code stands variable keeps code/information executed model method; @instance stands model instance; path stands path want redirect in case there no errors; render js: <...> used instead of redirect_to because you've set respond_to :html, :js in controller, way redirect use javascript, otherwise you'll full rendered page redirecting ajax response. flash.now allows access messages (in c

Manually create a group using SignalR -

i have list of userdetails connected hub , storing users list<userdetails> .i want add of users group , broadcast message group. not able figure out how can create group.this have done far: foreach(var user in userdetails) { groups.add(user.connectionid, "connected"); } clients.group("connected").broadcastmessage(message); when ever add user group, if group doesn't exist created you, don't need create specifically.

javascript - How can I target a specific dom css class that has a specific inline style without using indexOf method -

the answer worked me here. how can select element specific inline style? $('div').filter(function() { return $(this).attr('style') == undefined || $(this).attr('style').indexof('display: none;') == -1 }). however, being jquery 2+ , wondering if there better method acheiving same result. wish change above method requires using indexof js method obtain value of -1 or 0 truthy falesy type return. i have tried this: defaults select first style fines. , haven't figured way "filter" results specific class. $("[style='display: block;']").css("color", "yellow"); i figured out jsbin. yea... share answer... i used filter function above did attribute equals selector value .is method. here more info on jquery attribute equals selector. https://api.jquery.com/attribute-equals-selector/ here final code , jsbin 2 methods. let me know think. filter function looks if in "this" document

deployment - Click to deploy Drupal not working -

i signed free trial of google cloud intentions of trying out new drupal site launching. after signing up, selected "click deploy" attempted deploy drupal. when clicked button, nothing happens. i tried using chrome , ie, no luck. able deploy wp site not sure why drupal not working. please advise. thank you. there appears general issue deploying drupal on gce. google working on issue per this .

asp.net - Error: SignalRRouteExtension.Mapconnection is obsolete. use MapSignalR in Owin Startup class -

i developing asp.net mvc application asp.net signalr. getting error , couldn't find how solve this. global.asax class , getting error @ here when started project: public class mvcapplication : system.web.httpapplication { protected void application_start(object sender, eventargs e) { arearegistration.registerallareas(); webapiconfig.register(globalconfiguration.configuration); filterconfig.registerglobalfilters(globalfilters.filters); routeconfig.registerroutes(routetable.routes); //this added , getting error. routetable.routes.mapconnection<nfcconnection>("echo", "/echo"); } } and connection class @ bottom public class nfcconnection : persistentconnection { protected override task onconnected(irequest request, string connectionid) { string msg = string.format( "a new user {0} has joined. (id: {1})", request.querystring["name"