Posts

Showing posts from January, 2014

php - Codeigniter get_file_info() returns filename as false -

i building codeigniter based file browser having problem file information. i have loaded helpers: $this->load->helper('file'); $this->load->helper('directory'); when called var_dump(get_file_info('gui/default/uploads/profile_200x200.jpg')); here result: (note path relative site_url() ) array (size=4) 'name' => boolean false 'server_path' => string 'gui/default/uploads/subfold/profile_200x200.jpg' (length=47) 'size' => int 9714 'date' => int 1386054354 but when called get_filenames() or get_dir_file_info() same built-in file helper displays filenames correctly. experience or idea causes this? due bug function (read here ) use workaround: $file = 'gui/default/uploads/profile_200x200.jpg'; $fileinfo = get_file_info($file); if(!$fileinfo['name']) $fileinfo['name'] = basename($file);

algorithm - Testing tetrahedron-triangle intersection -

i want determine whether given triangle intersects tetrahedron. not want compute solution polygon(if exists) itself. there library/package/published practical algorithm can used solve problem directly (unlike attempt below)? i think last resort have use standard polygon-polygon intersection algorithm implementations solve problem indirectly . my attempt on problem: thought of breaking problem of polygon-polygon intersection. each triangular face(say t1 ) of tetrahedron , given triangle t2 , thought of doing following: compute intersection(a line) between planes corresponding each triangle, l1 . for each triangle: for each edge of triangle l2 , compute point of intersection p between l1 , l2 . test(maybe using parametric form) of l2 , if point lies on edge l2 . if both triangles t1 , t2 , there exists at least one edge on intersection point p lies, implies triangles(and hence given tetrahedron , triangle t2 ) do intersect. create orthonormal fr

html - Get some space on top when scrolling to a <h2 id="..."> link -

this question has answer here: fixed position navbar obscures anchors [duplicate] on html page have link like: <a href="/page.htm#something"> the other page (page.htm) looks like: <h1>header</h1> <p>some text</p> <h2 id="something">the header 2</h2> etc. when follow link page.htm#something header2 on top of browser. my wish room abow it, let's 1em or so. of course can use: <a name="something"><br /></a> <h2>the header 2</h2> but that's ugly , needs lot more typing. is there way link positioned lower in webbrowser? <h2 style="padding-top:20px">the header 2</h2> i understood you?

sql server - Foreach Container to loop through Multiple Excel File to load -

Image
i have had packages in past looping through multiple text files in folder , loading sql server tables. now asked create package loop through multiple excel files in folder , load them sql server table. i went through following steps create package assuming shouldn't different have in other packages loops through multiple flat file. added execute sql task , truncating staging table, simple truncate table statement. added foreach loop container . selected foreach file enumerator , created variable called file_path data type string. added data flow task . added excel data source . , configured excel connection manager selecting 1 'excel' file in destination folder. (at point configured correctly not showing red cross or warring messages.) then selected excel file connection manager , in properties windows under expressions , selected connection string property , used user variable @user::file_path . at point excel data source showing red cross need

java - Intent betwen 2 applications -

i ask if can pass other application data using intent. if it's possible, how can clicking button , passing other application? b1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { intent intention = new intent(?????); startactivity(intention); } }); to pass data 1 activity need add intent. e.g, intent intention = new intent(this, destclass.class); int value = 10; intention.putextra("key", value); startactivity(intention); and in destclass's oncreate() , intent with, bundle extras = getintent().getextras(); if (extras!= null) { extras.getint("key"); } to send application. create intent shown in android docs . intent sendintent = new intent(); sendintent.setaction(intent.action_send); sendintent.putextra(intent.extra_text, "this text send."); sendintent.settype("text/plain"); startactivity(sendintent); note in case android system allows a

java - JNA Windows get process path -

i found code on stackoverflow explain how running process on windows, name , pid kernel32 kernel32 = (kernel32) native.loadlibrary(kernel32.class, w32apioptions.unicode_options); tlhelp32.processentry32.byreference processentry = new tlhelp32.processentry32.byreference(); winnt.handle snapshot = kernel32.createtoolhelp32snapshot(tlhelp32.th32cs_snapprocess, new windef.dword(0)); try { while (kernel32.process32next(snapshot, processentry)) { system.out.println(processentry.th32processid + "\t" + native.tostring(processentry.szexefile)); } } { kernel32.closehandle(snapshot); } my question is: how can process path? using jna, need define moduleentry32 structure , map required functions : import java.util.arrays; import java.util.list; import com.sun.jna.native; import com.sun.jna.pointer; import com.sun.jna.structure; import com.sun.jna.platform.win32.kernel32; import com.sun.jna.platform.win32.windef; import com.sun.jna.win32.w32apioptio

java - How to persist tomcat sessions across restarts while using IntelliJ idea -

it seems intellij clears tomcat related folders across redeploy/restart. means every time restart tomcat intellij, have re-login our app. is there way persist tomcat sessions across restarts when using within intellij idea? the intellij configuration local tomcat instance has checkbox "preserve sessions across restarts". check that, , sessions should preserved. by way, i've seen number of developers waste lot of time on years messing around tomcat plugins in eclipse , intellij, trying figure out how them work in manner similar production. the easiest answer far use regular tomcat instance, , forego ide integration. 1 easy thing replace this, if using maven (you using build tool, aren't you?) use maven tomcat plugin .

c++ - Visual Leak Detector detects leak on new blank MFC project -

i installed vld try , debug c++ mdi mfc application in visual studio 2008. vld reported memory leak , no matter did not correct issue, created brand new blank project (mdi mfc) , memory leak still showing up. modification made writing #include <vld.h> in main project.h file. documentation says doesn't matter file, here output after execution (simply selecting file/exit , doing nothing else). 'project.exe': loaded 'c:\users\masterhd\documents\visual studio 2008\projects\project\debug\project.exe', symbols loaded. 'project.exe': loaded 'c:\windows\syswow64\ntdll.dll' 'project.exe': loaded 'c:\windows\syswow64\kernel32.dll' 'project.exe': loaded 'c:\windows\syswow64\kernelbase.dll' 'project.exe': loaded 'c:\windows\winsxs\x86_microsoft.vc90.debugmfc_1fc8b3b9a1e18e3b_9.0.21022.8_none_9b54853441e399d5\mfc90ud.dll', symbols loaded. 'project.exe': loaded 'c:\windows\winsxs\x86_microso

wpf - Absolute transparent web browser control, is it possible? -

i'm creating desktop winforms or wpf app, i'm using html/js/css create ui. simpliest solution using web browser control in host window. i want absolute transparent web browser control now. example, have div 50% transparency, should see windows desktop icons through div (the host form , web browser control should transparent). is possible? here several possibilities if not care size of browser window, can set width , height 0 . if want have specified browser window size, can set left equals -width , top equals -height . set parent of browser control null , browser control become invisible well. i prefer second solution.

google maps - Finding out bus stops on a set path/polyline -

my app finds route between 2 locations (transit locations). in bus/train polyline wanted find bus stops available, since google maps directions api doesn't provide results of intermediate stops. how 1 know bus stops in route? is way obtain decode polyline , latlng objects , find them places api? - ping google places api n times many latlng objects found, if there has done before, please share thoughts.

python - How to create graph where a geometry be surrounded by particles using Matplotlib? -

using examples , documentation matplotlib , can create 1 figure 2 graphs this . on left, geometry graph , on right, particles graph. want create graph geometry surrounded particles. how that? here code far: from mpl_toolkits.mplot3d import axes3d matplotlib import cm import matplotlib.pyplot plt import numpy np fig = plt.figure() vx = [] vy = [] vz = [] ins = open( "vertex.txt", "r" ) line in ins: nilai = line.strip().split() vx.append(float(nilai[1])) vy.append(float(nilai[2])) vz.append(float(nilai[3])) triangles = [] ins = open( "iface4.txt", "r" ) line in ins: nilai = line.strip().split() t1 = int(nilai[1]) t2 = int(nilai[2]) t3 = int(nilai[3]) if t1!=0 , t2!=0 , t3!=0: triangles.append([t1, t2, t3]) ax = fig.add_subplot(121, projection='3d') #ax = fig.gca(projection='3d') ax.plot_trisurf(vx, vy, vz, triangles=triangles, cmap=cm.jet, linewidth=0.2) vx = [] vy = [] vz = [

ios - Swift - Error calling a function from another function -

this question has answer here: passing array function variable number of args in swift 7 answers while following apple's book "the swift programming language" i ran across issue while working on "experiment - write function calculates average of arguments." first chapter. to determine average of set of numbers, want reuse sum of numbers [setof(numbers: int...)] function , divide count of numbers [numbers.count]. receiving error: could not find overload '__conversions' accepts supplied arguments when try call sumof(numbers) averageof(numbers) function. what should change call sumof(numbers) function correctly, averageof(numbers) function? func sumof(numbers: int...) -> int { var sum = 0 //0 number in numbers { sum += number } return sum //651 } sumof(42, 597, 12) //651 func averageof(

css - CSS3 nth-of-type combined with a class -

i have page wrapper class called .j-l-page-wrapper . have section wrapper class called .j-v-section-wrapper . each section wrapper in page wrapper have alternating background colors. have used following css: div.j-l-page-wrapper div.j-v-section-wrapper:nth-of-type(even) { background-color: @j-var-color-section-wrapper-bg-mod1; } div.j-l-page-wrapper div.j-v-section-wrapper:nth-of-type(odd) { background-color: @j-var-color-section-wrapper-bg-mod2; } along html <div class="j-l-page-wrapper"> <div class="j-v-section-wrapper"></div> <div class="j-v-section-wrapper"></div> <div class="j-v-section-wrapper"></div> <div class="j-v-section-wrapper"></div> </div> however, no alternating background coloring applied, leading me think have not applied correct selector. how say, using css3, apply even / odd based background coloration div of 1 type co

ios - UIkit Dynamics in swift -

trying convert objective c code swift , struggling achieve results. animator = [[uidynamicanimator alloc] initwithreferenceview:self.view]; _gravity = [[uigravitybehavior alloc] initwithitems:@[square]]; at moment have got animator.referenceview = self.view doesn't work though. can guide me in right direction. in advance full code let square = uiview() square.frame = cgrectmake(100, 100, 100, 100) square.backgroundcolor = uicolor.redcolor() self.view.addsubview(square) var animator = uidynamicanimator() var gravity = uigravitybehavior() animator.referenceview = self.view animator.addbehavior(gravity) holex on it, key have store reference animator, here's working example: class viewcontroller: uiviewcontroller { var animator:uidynamicanimator? override func viewdidload() { super.viewdidload() let square = uiview() square.frame = cgrectmake(100, 100, 100, 100) square.background

javascript - D3je: how to select all data points with specific value of particular data field -

i have d3js heatmap graph made using code , reacting on click event: var heatmap = svg.selectall(".hour") .data(availplain) // abriged... .on("click", function (d, i) { // toggle special class clicked item d3.select(this).classed("selectedclass", d3.select(this).classed("selectedclass") ? false : true); var isshown=d3.select(this).classed("selectedclass"); }); the looks of parameter d passed in on-click handler such: {"g":"16","station":"91","rid":"360"} which element of availplain array or objects used make graph. want iterate on d3 elements have same "g" value , toggle class them well. quite sure follow-up of select/selectall shall used difficult comprehend actual code using documentaion ( https://github.com/mbostock/d3/wiki/selections ). so, how "classed" items have data c

java - Differences : @SessionScoped vs @Stateful and @ApplicationScoped vs @Singleton -

i know, principal differences between : javax.enterprise.context.sessionscoped , javax.ejb.stateful javax.enterprise.context.applicationscoped , javax.ejb.singleton i know @sessionscoped , @stateful allows create new instance each client. know @applicationscoped , @singleton / @stateless shared between clients. => when should consider it's better choose ejb, or other? @sessionscoped denotes scope while @stateful in way call stereotype. @stateful adds number services bean, among transactional behavior , passivation. central @stateful session behavior, indeed overlaps session scope. the difference session scope tied http session, while @stateful open-ended user managed session, lifetime managed client has reference bean proxy. @stateful remote beans binary (rmi) counter parts of servlets. servlets listened remote http requests browser, @stateful remote beans listened remote rmi requests applets (and later swing clients). there unfortunat

c# - Getting reference error on naming controls - WPF -

i have solution named solution1, has multiple projects named project1, project2 etc. in project1, have usercontrol called "designelement". when name usercontrol xaml, using "x:name" , compile it, following compile error: "the type or namespace name 'project2 ' not exist in namespace 'solution1.project1.project2' (are missing assembly reference?)" where reference of project2 coming in project1? why compile error arise? also, if not going use "x:name" in controls, solution compiles , runs fine. on same appreciated. just because have 2 projects in same solution doesn't mean can instantly see each other. here proper flow making them see each other create solution add projects in project 2 right click on references in solution explorer , hit add reference ^^^^^this step missed^^^^ in collumn on left of popup click solution choose project one add using or xmlns in code project one r

android - ImageView inflater unreachable code -

i'm trying inflate imageview android says it's unreachable code imageview imageview = (imageview) row.findviewbyid(r.id.imagev); , have remove it. error? package com.examples.listimage; import android.os.bundle; import android.app.activity; import android.content.context; import android.content.res.resources; import android.view.layoutinflater; import android.view.menu; import android.view.view; import android.view.viewgroup; import android.widget.arrayadapter; import android.widget.imageview; import android.widget.listview; import android.widget.textview; public class listimage extends activity { string[] myimages; string[] descript; int [] images = {r.drawable.ic_launcher, r.drawable.red, r.drawable.strange}; listview list; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_list_image); resources res = getresources(); myimages = res.getstringarray(r.array.images);

.net - SQL Azure database design issue -

i building database store categories, , every category has multiple sub-categories. i trying find best way design cant think of except creating 1 table each category, feels bit messy seeing how there @ least 50 categories. there way can create "category"-table , somehow have column called "subcategories" lists multiple strings? if so, how split these subcategories can retrieve them without problem application? your comment solution people go with. create table categories , , second table subcategories . categories have unique primary key categoryid (think identity ). subcategories have primary key subcategoryid , foreign key categoryid now lets have category in code , want of subcategories: declare @categoryid bigint = 23 select s.subcategoryid, s.categoryid, s.name subcategories s s.categoryid = @categoryid of course if using database access technology entity framework won't writing kind of sql ef take care of you.

c - Same simple calculation, different results -

using gcc 4.8.2 (ubuntu 14.04) different results while calculating value same way. there's difference depending on architecture (32 bit / 64 bit) on systems tested. #include <math.h> #include <stdio.h> int main() { float h = 0.11f; float y = 0.11f; float g = 1.37906f; float x = 2.916949f; float result1 = (h * y / fabs(g)) / x; float result2 = h * y / fabs(g); result2 /= x; float result3 = (h * y / g) / x; printf("%.20f \n", result1); //0.00300796888768672943 printf("%.20f \n", result2); //0.00300796912051737309 printf("%.20f \n", result3); //0.00300796912051737309 on x64 //0.00300796888768672943 on x32 } what's reason , how can anticipate or avoid these differences ? edit: casting fabs float doesn't change results, @ least on system (see comments oli charlesworth). instead of forcing c compilers implement exacting standard floati

javascript - indexedDB doesn't reset version when you delete a database on Chrome -- bug or user error? -

the following code throws error in chrome 35 (but not firefox 29) if set buggy true . since i'm pretty new in indexeddb wanted ask whether ought work or not. if delete database , open again version=1 , shouldn't onupgradeneeded callback called? <html> <head> <script type="text/javascript"> var = 1000; var buggy = true; function open() { var version = buggy ? 1 : 1001 - i; var request = indexeddb.open("test", version); var upgraded = false; request.onupgradeneeded = function() { upgraded = true; console.log("upgraded ok"); } request.onsuccess = function() { if (!upgraded) { throw "not upgraded"; } console.log("open ok"); if (--i != 0) { obliterate(); } } request.onerror = function() { throw "error in open"; } }

arduino - Serial port shown in device manager but unable to access/found? -

i've installed arduino virtual usb serial port driver, it's appeared com4 on device manager. double checked listing available serial ports in powershell > [system.io.ports.serialport]::getportnames() com1 com4 however, when try echo serial port, says not exist > echo helloworld > com4 system cannot find file specified. i trying upload firmware in arduino, kept getting denied port. trying different usb gives me same result. wrote small program test serial port , error: the serial port "com4" not exist. the device name of serial port on windows \\.\comn n port number. device driver can emulate dos device name , "com4" if chooses so, simple in device driver code. that's increasingly rare thing do, port numbers larger 2 , port numbers larger 4. seeing echo command fail not unusual. a serial port cannot shared, can opened once process , else tries open fail-whale error_access_denied error code. so, serial ports sit

windows phone 8 - Play a selected song in MediaLibrary WP8 -

here problem : have longlistselector list songs medialibrary , selectionchanged event. when user taps on song longlistselector, plays song once, then stops. i'd play next song medialibrary once selected song finished here longlistselector : <phone:longlistselector x:name="llssongs" selectionchanged="llssongs_selectionchanged" margin="0,-30,0,0"> <phone:longlistselector.itemtemplate> <datatemplate> <stackpanel margin="5,5,5,5"> <textblock text="{binding name}" fontsize="20" foreground="black"/> <textblock text="{binding artist}" fontsize="15" opacity="0.75" foreground="black"/> </stackpanel> </datatemplate> </phone:longlistselector.itemtemplate> </phone:longlistselector> and selectionchanged method private void llssongs_s

Javascript If array element contains a period -

i want search through array i've made string, if has period @ end of element, randomly (50% chance) add "arr!" before next sentence. problem is, don't quite know how check if there period @ end of given array element. i'm guessing regular expressions best, i'm terrible them... able provide insight?? var things = output2.value.split(" "); (var = 0; < things.length; i++) { things[i] += " "; if (things[i]==".") { var randnumb = math.floor((math.random() * 2) + 1) if (randnumb == 1) { things[i] += " arr!" }; } }; regex inefficient. var stringtocheck = 'something'; var period = '.'; //check if string ends period (.) if (stringtocheck.indexof(period, this.length - period.length) !== -1) { //your code here }

Design pattern for PHP classes sharing data from SQL queries -

i'm beginner oop. following jist of code, trying find proper design pattern for: class data { public $location = array(); public $restaurant = array(); } $data = new data; $query = mysqli_query($mysqli, "select * restaurants"); //actually big long query, simplified illustrative purposes here $i = 0; while ($row = mysqli_fetch_array($query)) { $data->location[] = $i.')'.$row['location']."<br>"; $data->restaurant[] = $row['restaurant']."<br>"; $i++; } i'd access data class php page. (to print out information in html, hence tags). prefer not run query twice. understand classes created , destroyed in single php page load. i'd appreciated design pattern guidance managing http application state , minimizing computer resources in such situation. if store data object in $_session variable, have access other pages , upon refresh. mentioned in other post , comments, want separate out html data

logging - where does go write panic logs? -

i installed golang on redhat server through epel. i'm trying analyze panic logs can't find logs stored. hint ? there no trace in /var/log func main() { http.handlefunc("/", panicrecover(test)) log.fatal(http.listenandserve(":80", nil)) } func test(){ out, err := exec.command("echo ", "something").output() if err != nil { log.panic(err) } } func panicrecover(f func(w http.responsewriter, r *http.request)) func(w http.responsewriter, r *http.request) { return func(w http.responsewriter, r *http.request) { defer func() { if r := recover(); r != nil { log.printf("panic recovered:%s\n", r) } }() f(w, r) } to stderr . for example, package main import "log" func main() { log.panic("log.panic stderr") } $ go run panic.go

python - SSlError from concurrent s3 file download -

so can't life of me figure out how fix bug.... basically have program downloads of files s3 bucket , parses through each file's contents , adds records database. doing sequentially slow, decided try downloading , processing files in parallel using multiprocess module since whole process doesn't need have sort of shared memory or locking system. therefore made code following: from multiprocess import pool import boto def dowork(s3key): # connect s3 bucket , s3 file key conn = boto.connect_s3('aws_key_id', 'aws_secret_access_key') bucket = conn.get_bucket('my_bucket') key = bucket.get_key(s3key) ##########error thrown call##################### key.get_contents_to_filename('my_file') # insert database here.... if __name__ == '__main__': pool = pool() # every s3 file in bucket, download/process file in parallel worker s3keyname in s3keyname_list: pool.apply_async(dowork, s3ke

c# - Using RenderPartial to assign Model Property values -

i new mvc platform , trying simple application hold of framework, application:i designing admin application has form enter question , multiple options database, have viewmodel called "questionviewmodel" has properties "quesiton" , list of optionsviewmodel in it, "optionviewmodel" consists of "option" , "isrightanswer" properties, on ui, have questionview displays textbox question , want question have 4 options, created partialview called "questionoptionview" takes "optionviewmodel" model, loop 4 times through partialview , display textbox "option" , "isrightasnwer" radiobutton, the ui displays tetsbox "question" , 4 other "textboxes" entering "options", when post form, "options" not bind viewmodel how can achieve model binding these partialview data main viewmodel?? public class questionviewmodel { [display(name = "enter question")]

Splash screen in android -

i having application have splash screen. problem need splash screen pinwheel spinner(progress bar). have added android java code. java code package com.ssf; import android.os.bundle; import android.widget.toast; import com.worklight.androidgap.wldroidgap; public class ssf extends wldroidgap { @override public void oncreate(bundle savedinstancestate){ super.oncreate(savedinstancestate); } /** * onwlinitcompleted called when worklight runtime framework initialization complete */ @override public void onwlinitcompleted(bundle savedinstancestate){ super.loadurl(getwebmainfilepath()); // add custom initialization code after line } } having splash screen redundant, , should avoided unless maybe it's first run of app. users open app , start using right away. only heavy apps (mostly games ) need load lot of things, there, there plenty of optimizations make short (just load needs in near future, examp

c++ - TinyXML issue with VC++ -

i collecting netstat information. program working when in tinyxml tag shows null while in console application same program runs successfully char command[50]; tixmlelement* msg31 = new tixmlelement( "port" ); tixmlelement childtext0( "type" ); tixmlnode* childnode0; cstring stemp; strcpy( command, "netstat -aon | findstr 3306" ); stemp.format(_t("%s"), system(command)); childtext0.value = "mysql_port" ; childtext0.linkendchild(new tixmltext(getchararray(stemp))); childnode0 = msg31->insertendchild( childtext0 ); childtext0.clear(); net->linkendchild(msg31); this program runs sucessfully. problem in xml shows null value. output of xml below. problem code? output of xml(you can see mysql_port null) <network> <port> <mysql_port>(null)</mysql_port> </port> </network> the return value of syst

java - Why does OnDraw get called continuously on earlier Android versions? -

while testing app have made on android version 2.3.4 ondraw called continouisly on 4.1.1 works intended. i still new android development wondering changed between versions cause , trying hands on more android devices see if happening others. thanks

php - How to add comment with JIRA REST Api to issue Subversion tab -

i have problem jira post adding. i'want added comments in subversion or commits tab, i've managed put in comments section. if not possible ask how edit html of comment the commits tab getting data subversion or git, can't add comments there

ruby on rails - Scope ordering by reverse order not working -

i have scope: scope :latest_photos, -> {order(:created_at).reverse_order.limit(10)} it's supposed put latest photos in first place right? photos put on last place instead. i've tried: scope :latest_photos, -> {order('created_at desc').limit(10)} but nothing. ideas? thanks! edit something not working here: routes.rb get 'spots/ultimos' => 'photos#latest photos controller def latest @categories = category.all @zones = zone.all @photos = photo.latest_photos @action = 'general' @photos = photo.paginate(:page => params[:page]) render :index end model scope :latest_photos, -> {order(created_at: :desc).limit(10)} def latest @categories = category.all @zones = zone.all @photos = photo.latest_photos @action = 'general' @photos = photo.paginate(:page => params[:page]) render :index end you have assigned @photos vari

c# - Parse Notification .net UTF-8 format -

i using parse .net api pushnotification android. webservice here private bool pushnotification(string pushmessage) { bool ispushmessagesend = false; string poststring = ""; string urlpath = "https://api.parse.com/1/push"; var httpwebrequest = (httpwebrequest)webrequest.create(urlpath); poststring = "{ \"channels\": [ \"trials\" ], " + "\"data\" : {\"alert\":\"" + pushmessage + "\"}" + "}"; httpwebrequest.contenttype = "application/json"; httpwebrequest.contentlength = poststring.length; httpwebrequest.headers.add("x-parse-application-id", "my parse app id"); httpwebrequest.headers.add("x-parse-rest-api-key", "my rest api key"); httpwebrequest.method = "post"; streamwriter requestwriter = new streamwriter(httpwebrequest.getre

javascript - JS Array Splice to remove an element in an Array -

i have table being populated array containing list of products , quantities order placed customer. on order confirmation screen user can remove items in order clicking delete button associated particular row . this html <div id="summary"> <table id="ordertable"> <tr><th>product</th> <th>quantity</th> <th></th> </tr> </table> </div> this js if($.cookie('order_cookie') != undefined){ productarray = json.parse($.cookie('order_cookie')); $.cookie('order_cookie', json.stringify(productarray), { expires: 1, path: '/' }); } var ordertable = document.getelementbyid("ordertable"); //loop through array for(i = 0; < productarray.length; ++){ item = productarray[i]; var x = item.split(':'); var row = ordertable.insertrow(1); var cell1 = row.insertcell(0); var cell2 = row.in

c - why does derefrencing a pointer to an array of integers(in 2d array) return(or decay to) pointer to first element? -

i have read many posts of pointers , 2d array relation, cant seem understand concept. lets there 2d array int a[3][2] , array int b[2] . a returning pointer array of integers of size 3. of type int (*)[2] . as understanding of concept goes derefrencing it( *a ) give me array , this decays pointer pointing first element of 1d array , of type (int*) . bold part doubt. why , how decay happen array itself(which complete 1d array a[0]) decays first element of 1d array? (cant seem why , how part) , cant seem find on other links also. as a[0] , *a , &a[0][0] represent same pointer. here a[0] first 1d array. true b (declared above) , a[0] represent same thing (both being 1d array , decay pointer first element in array of type (int*)? why , how decay happen array decays first element of 1d array? c11: 6.3.2.1 p(3): except when operand of sizeof operator, _alignof operator 1 ,the unary & operator, or string literal used initialize array, e

Space between two output labels in jsf -

i developing page using jsf2.0 & prime faces have requirement need place 2 output lables in single line space. like this address 1: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ address 2: i wrote below code <h:panelgrid columns="2" styleclass="companyheadergrid" > <p:outputlabel value="address 1 : " /> <h:outputtext value="38th street pharmacy" /> <!-- here need address 2 @ right side of page same line address 1--> <p:outputlabel value="state : " /> <h:outputtext value="texas" /> <p:outputlabel value="zip code : " /> <h:outputtext value="123456" /> <p:outputlabel value="phone : " /> <h:outputtext value="9700300009&q

git - Cyrillic text appears garbled in the VisualStudio.com web interface -

i using visualstudio.com git store source code, , screws ukrainian text , instead of: withsuccess("Збережено"); i getting smt that: withsuccess("Çáåðåæåíî"); i not sure problem on local pc looks , after pushing commits can see on web it's changed. is there configuration helps solve problem? ... can see on web it's changed. the problem there's no meta-information attached files stored in git repository hint a renderer (in case—that web site engine renders content of file) in encoding file encoded. git of time treats stores opaque binaries, , encodings come consideration in of ui parts ( git log , gitk , git gui ). so see part misbehaves, clone pushed repository afresh other place (on local pc) , check contents of files containing cyrillic text. if see ok, live or file feature request against online service support user-specific encoding hints—like gui.encoding configuration variable used git tools—so specify encoding fil

windows - Error while deleting log files in IIS -

i facing space problem in live server lot of websites running in iis. while trying delete log files facing problem: the process cannot access file because being used process i have tried lot stop services , end process of explorer.exe. below command command prompet work del c:inetpub\logs\logfiles*.logs /s it delete log files

Java : image processing - how to get set of images to same standard -

i need develop simple skin disease diagnose system using image processing , neural network. use images in neural network, image should same standard and, identify skin disease should apply image processing technique well. but don't know image processing technique apply first , they? read references think need apply image filtering technique, edge detection technique , etc... can expert in please specify image processing technique step step. no need coding want know image processing technique names , there order. this reference: reference i think when "images should same standard" mean images should represent similar patterns in similar form in order train neural network. however, suppose not train neural network using image itself, in other words, pixel values. you'll extract features images such purpose. in case dealing patterns can recognized shape, in order use "images in same standard" should apply morphological image operations

cassandra - Check if a certain file exists in CFS from Java code -

after online example tried following: configuration config = new configuration(); config.set("fs.default.name","cfs://x.x.x.x:9000/"); // actual ip in here config.set("fs.cfs.impl","org.apache.cassandra.hadoop.fs.cassandrafilesystem"); filesystem fs = filesystem.get(config); system.out.println(fs.exists(new path("cfs:///path/to/file"))); but can't find jar containing cassandrafilesystem . wonder if it's old version or something. have cql driver in classpath, i.e., gradle dependency com.datastax.cassandra:cassandra-driver-core:2.0.1 , class cassandrafilesystem not ship artifact. what's idiom check file existence in cfs? using datastax enterprise 4.0.1. edit : clear, problem here seems finding class cassandrafilesystem . can't find anywhere in dse jar although usage documented. deprecated? in other jar besides com.datastax.cassandra:cassandra-driver-core:2.0.1 ? if have maven project add following mav

c# - WPF Ribbon Contextual Tab Visibility binding -

i finding surprisingly hard find examples of binding visibility of ribboncontextualtabgroup . have property in code-behind should decide when display ribbon tab, i've tried far has no effect. code-behind essentially: public partial class mainwindow : ribbonwindow { public string port { get; set; } } a summary of wpf code below. i'm looking solution binds visibility property whether or not mainwindow.port null . <ribbon:ribbonwindow ... xmlns:src="clr-namespace:magexplorer" /> ... <ribbon:ribbontab x:name="comtab" header="com" contextualtabgroupheader="communications"> ... </ribbon:ribbontab> <ribbon:ribbon.contextualtabgroups> <ribbon:ribboncontextualtabgroup header="communications" visibility="<what goes here?>" /> </ribbon:ribbon.contex

ios - Extra argument 'boolForKey' in call? -

i making things happen when app launches. put statement. returns error: extra argument 'boolforkey' in call . i using swift. how fixed? code: if nsuserdefaults.standarduserdefaults(boolforkey: "haslaunchedonce") { //app has launched before } else { nsuserdefaults.standarduserdefaults(setbool: true, forkey: "haslaunchedonce") nsuserdefaults.standarduserdefaults(synchronize) //first time launch } how fixed? it looks call should be: if nsuserdefaults.standarduserdefaults().boolforkey("haslaunchedonce") { that's because objective-c method name -boolforkey: , not -standarduserdefaults:boolforkey: . when translating swift, put first part of method name before left parenthesis, subsequent parts appearing inside parens.

Perform regular expression on a PERL PDL variable -

is possible perform regular expression on n-dimension pdl variable? for example can add 100 elements doing $a1 = pdl [1,2]; print $a1 + 100; however if array bunch of strings perform task on. example fails: $a = pdl ['suze','david']; $a =~ s/suze/female/; print $a; not sure if possible, in advance. the point is, pdl perl extension designed scientific , bulk numeric data processing , display. not made string manipulating. when try iterate through piddle: use strict; use warnings; use pdl; $a = pdl ['suze','david']; print $_ . "\n" foreach ($a->list); you get: argument "suze" isn't numeric in subroutine entry @ basic/core/core.pm.pl (i.e. pdl::core.pm) line 1296, <data> line 207. 0 0 argument "david" isn't numeric in subroutine entry @ basic/core/core.pm.pl (i.e. pdl::core.pm) line 1296, <data> line 207. when take deeper pod, find: $a = pdl(scalar|array reference|arr

security - Record duplication issue which has been claimed as CSRF attack -

we facing record duplication issue has been claimed csrf attack. the scenario admin user logged in application , adding record, data getting saved in database. corresponding post request getting captured , replayed ends adding duplicate records in database. vulnerability allows attacker add 'n' number of duplicate records in database on replay. can called csrf attack? no, not really. if post being captured, looking @ replay attack , wherein legitimate request replayed again. you can defeat replay attacks adding nonce (random value) form, , requiring random value present when post done, invalidating nonce. same technique used foil csrf attacks. however, if attacker can read post data, may have bigger problems. example, capable of capturing admin authentication step, can reveal passwords or other sensitive information. it's possible aren't under attack, , duplicates caused use of either button or page reloads. in case, safest use kind of defens

sql server - How Merge Duplicate Data using MergeTable? -

there duplicate record in table. wrote query find them. result this: +-----------+-------------+-------------+ | row | nationalno | client id | +-----------+-------------+-------------+ | 1 | 10003 | 34 | +-----------+-------------+-------------+ | 2 | 10003 | 75 | +-----------+-------------+-------------+ | 1 | 20023 | 23 | +-----------+-------------+-------------+ | 2 | 20023 | 55 | +-----------+-------------+-------------+ | 3 | 20023 | 12 | +-----------+-------------+-------------+ the above result means have 1 client national-no of 10003 whom inserted twice , client national-no of 20023 whom inserted 3 time in client table. not going delete extra. want keep first record active , rest inactive. task save actions history in mergetable. mergetable has 3 columns: clientida, clientidb, date want consider records row of 1 clientida , rest of them clientid

java - Handle buttons click event in custom notification in android -

i have custom notification 3 buttons ("previous", "play/pause", "next"). can catch click event when there 1 button, 3 buttons can't know button of them clicked. question "how know button clicked?" my notification code private void initnotification() { string ns = context.notification_service; int icon=r.drawable.tmc; long when=system.currenttimemillis(); notification notification=new notification(icon, "the music class", when); notificationmanager mnnotificationmanager=(notificationmanager)getsystemservice(ns); remoteviews conviews=new remoteviews(getpackagename(),r.layout.notification); conviews.setimageviewresource(r.id.image, r.drawable.tmc); conviews.settextviewtext(r.id.title, song_title); notification.contentview=conviews; intent nintent=new intent(this,musicplayeractivity.class); pendingintent conpendingintent=pendingintent.g

c# - Bitmap.FromHbitmap erroring when called over RDP -

our application cursor manipulation enable "relatively" nice drag drop animation on winforms (at time wpf wasn't option). when using application on rdp session throws generic gdi+ exception. the method throws this: [dllimport("user32")] private static extern bool geticoninfo(intptr hicon, out iconinfo piconinfo); [dllimport("user32.dll")] private static extern intptr loadcursorfromfile(string lpfilename); [dllimport("user32.dll", setlasterror = true)] public static extern bool destroyicon(intptr hicon); [dllimport("gdi32.dll", setlasterror = true)] private static extern bool deleteobject(intptr hobject); public static bitmap bitmapfromcursor(cursor cur) { iconinfo iinfo; geticoninfo(cur.handle, out iinfo); bitmap bmp = bitmap.fromhbitmap(iinfo.hbmcolor); deleteobject(iinfo.hbmcolor); deleteobject(iinfo.hbmmask); bitmapdata bmdata = bmp.lockbits(new rectangle(0, 0, bmp.width, bmp.height), imagelo