Posts

Showing posts from April, 2011

Add bootstrap input data to mysql using ajax, jquery and php -

here have bootstrap modal window: <!-- modal --> <div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title" id="mymodallabel">add new row</h4> </div> <div class="modal-body"> ...... <div class="input-group"> <span class="input-group-addon">ime</span> <input type="text" id="ime" class="form-control" placeholder="upisi ime"> </div> </br> <div class="inpu...

orbeon - XForms: CSS for a label -

Image
i need 1 word in label red. when have static text, works fine, can see here: but want use in label value of control. trying with: <xf:label value="concat('is name ', xxf:bind('control-1-bind'), ' ?')"/> but how can make imported value (control-1) red? try following: <xf:label mediatype="text/html"> name <xh:span class="labas"><xf:output value="xxf:bind('control-1-bind')"/></xh:span>? </xf:label>

Grails render template unit test issue -

i've got action in controller: def dirtymarker() { render(template: '/layouts/modals/marker/dirtymarker') } and id unit test it. ive been trying lots of possibilities. may seem simple, nothing seems work (grails 2.2.3). know here, testing might not important ive got lots of other methods returns rendered template , dont know how implement test.. seems me should work: void dirtymarker() { controller.metaclass.render = { map params -> assert params.template == '/layouts/modals/marker/dirtymarker' return 'a' } def result = controller.dirtymarker() assert result == 'a' }

android - Google Play games: getRawScore does not get the local Score when offline -

i using google games services trying update user score offline. works fine there cool feature that: http://developer.android.com/reference/com/google/android/gms/games/leaderboard/onscoresubmittedlistener.html#onscoresubmitted(int , com.google.android.gms.games.leaderboard.submitscoreresult) if device offline or otherwise unable post score server. score stored locally , posted server next time device online , able perform sync (no further action required client). so, imagine user has 100 points, score gan grow 200,300,etc. , updated when going online. unfortunately, when querying score getrawscore score returned not offline one, rather last value server. is there way fix this? workaround? i think it's way worse that: according tests, getrawscore() (or other methods getrank(), ...) return up-to-date data if displayed corresponding leaderboard default intent. if never did, won't value. see post here: play games loadleaderboardmetadata() retur...

c# - "Cannot insert explicit value for identity column in table 'tbl Fingerprint' when IDENTITY_INSERT is set to OFF -

[webmethod] public bool addstudent(student student) { bool uploadsuccess = false; cn.open(); int studentid = 0; using (sqlcommand com = new sqlcommand("insert tblstudent (studentnumber, name, surname, dob, gender, emailaddress, address1, address2, city, postcode, username, password, course) values ('" + student.studentnumber + "' ,'" + student.name + "' ,'" + student.surname + "' ,'" + student.dob + "', '" + student.gender + "' ,'" + student.emailaddress + "' ,'" + student.address1 + "' ,'" + student.address2 + "' ,'" + student.city + "' ,'" + student.postcode + "' ,'" + student.username + "' ,'" + student.password + "' ,'" + student.course + "')", cn)) { ...

Several Adsense Slots Insertion With JavaScript -

i need insert several adsense slots in same page using javascript. as can see in dynamic adsense insertion javascript , it's needed rewrite document.write use global vars google_ad_client, google_ad_slot, etc.. like this: (thanks https://stackoverflow.com/users/188740/johnnyo ) <script> window.google_ad_client = "123456789"; window.google_ad_slot = "123456789"; window.google_ad_width = 200; window.google_ad_height = 200; // container want ad inserted var container = document.getelementbyid('ad_container'); var w = document.write; document.write = function (content) { container.innerhtml = content; document.write = w; }; var script = document.createelement('script'); script.type = 'text/javascript'; script.src = 'http://pagead2.googlesyndication.com/pagead/show_ads.js'; document.body.appendchild(script); </script> the issue is: if have 1 globla var slot... how can insert several ads in same page u...

firebird - How to limit number of records in Dynamic SQL -

i want execute select query return limited number of records in dynamic sql firebird database server. similar 1 in sql of mssql select top 10 * table; p.s., using interbase 6.0 database firebird 2.5 odbc driver. you can't interbase 6.0 doesn't have feature. first n skip m added in firebird 1.0, , rows m n added in firebird 2.0. use firebird 2.5 odbc driver(*) irrelevant: can use features offered interbase 6. interbase 6 +/- 15 years old. should consider upgrading, either firebird 2.5 or recent version of interbase. (*): there no firebird 2.5 odbc driver, latest version of firebird odbc driver 2.0.2

android - "POST /receiver/ HTTP/1.1" 500 137512 -

server side - python programming django framework: views.py from django.http import httpresponse django.shortcuts import render django.views.decorators.csrf import csrf_exempt import django.utils.simplejson json @csrf_exempt def rcvr(request): if request.method=='post': objs = request.post.get['username'] return render(request, "post.html",{'username': username}) else: return httpresponse("failure...") urls.py from django.conf.urls import patterns, include, url django.contrib import admin receiver import views admin.autodiscover() urlpatterns = patterns('', # examples: # url(r'^$', 'woodpecker.views.home', name='home'), # url(r'^woodpecker/', include('woodpecker.foo.urls')), # uncomment admin/doc line below enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # uncomment...

excel 2010 - Is there a function that returns its host cell's address? -

how reference cell's own address argument use in function holds. i want use host cell's address within offset function contained in host cell. try. =cell("address") returns: $a$1 if want pass reference function: =indirect(cell("address"))

Significance of "-m" option in svn import -

what "-m" option specify in svn import command? eg:- "svn import project file:///repository_name/project -m "first import" " from command line output of svn import : -m [--message] arg : specify log message arg for better understanding of log messages, see svn log .

regex - java.lang.IndexOutOfBoundsException: No group 1 | Pattern matching -

i trying extract value of version accept header can of form "vnd.example-com.foo+json; version=1.1" here code extracting version val resourceversionpattern: pattern = pattern.compile("(?<=version=).*") def getresourceversion(acceptheader: string): string = { import java.util.regex.matcher val matcher: matcher = resourceversionpattern.matcher(acceptheader) if(matcher.find()) ("v" + matcher.group(1)).trim() else "v1.0" } when invoking above function intended extract version (for example can of form v1.0 or v1.5 or v2.5) getresourceversion("vnd.example-com.foo+json; version=1.1") i following exception: java.lang.indexoutofboundsexception: no group 1 @ java.util.regex.matcher.group(matcher.java:487) @ .getresourceversion(<console>:12) @ .<init>(<console>:11) @ .<clinit>(<console>) @ .<init>(<console>:11) @ .<clinit>(<console...

java - Uploading images using Servlet 3.0 -

i have simple form enctype "multipart"; using upload image server. have 2 possible solutions, neither of them complete. first solution: fileitemiterator iterator = upload.getitemiterator( request ); while( iterator.hasnext() ){ fileitemstream item = iterator.next(); if( item.isformfield() ){ // store img } } // ~while( iter.hasnext() ) in solution, can't dimensions of uploaded file, can if it's form field or not (using item.isformfield() ) my second solution uses servlet 3.0 api: for( part part: request.getparts() ){ system.out.println( part.getsize() ); } here can size of uploaded image, can't tell whether it's simple form field or not. what missing? what need me? as mentioned in documentation of fileitemstream the isformfield() method tells whether if simple form field returns true , otherwise return false . so upload image return false so should following : if(! item.isformfield() ){ ...

video - RGB-frame encoding - FFmpeg/libav -

i learning video encoding & decoding in ffmpeg. tried code sample on page (only video encoding & decoding part). here dummy image being created in ycbcr format. how achieve similar encoding creating rgb frames? stuck at: firstly, how create rgb dummy frame? secondly, how encode it? codec use? of them work yuv420p only... edit: have ycbcr encoder , decoder given on page . thing is, have rgb frame-sequence in database , need encode it. encoder ycbcr. so, wondering convert rgb frames ycbcr (or yuv420p) somehow , encode them. @ decoding end, decoded ycbcr frames , convert them rgb. how go ahead it? i did try swscontext thing, converted frames lose color information , scaling errors. thought of doing manually using 2 loops , colorspace conversion formulae not able access individual pixel of frame using ffmpeg/libav library! in opencv can access like: mat img(x,y) no such thing here! totally newcomer area... someone can me? many thanks! the best way conv...

function - calling class object from other class Not using "global" php -

i new php please excuse lack of knowledge. using eclipse , have project 3 files inside project. creating find discount class takes class object call function class. error: notice: undefined variable: getinfoclass line .. fatal error: call member function getage() on non-object line ... i tried read cant seem understand it. please help. thanks formresponse: include "getinfo.php"; include "ifdiscount.php"; $ifdiscount= new ifdiscount(); echo $ifdiscount->finddiscount(); class ifdiscount: class ifdiscount { public function finddiscount(){ $age = $getinfoclass->getage(); echo $age;}} $getinfoclass not available finddiscount() because out of scope. should pass finddiscount() parameter make available method: public function finddiscount($getinfoclass){ $age = $getinfoclass->getage(); return $age; } echo $ifdiscount->finddiscount($getinfoclass); (you want return $age , not...

reporting services - 1 row from DataSet A to many from DataSetB -

i'm trying create report display's document in db across multiple tables. have querys , datasets set fine, i'm having issues grouping right on report itself. to make clear i have 1 row dataset needs displayed , under it, each row dataset b. like dataset fields (basically "for each") dataset b fields keep repeating "for each" how go this? what return relevant field(s) dataset on every row fields dataset b , group on dataset field. example: select dataseta.id, datasetb.code, datasetb_description, datasetb.value dataseta inner join datasetb on dataseta.id = datasetb.dataseta_id on tablix, create group changes on id , put datasetb fields in detail row of tablix. each time dataseta.id changes, trigger new group header , display datasetb rows relate dataseta id under it.

utf 8 - mysql charset latin1 into utf-8 conversion issue -

my client's web app has large database millions of records. table's encoding latin1. when fetch text field holds huge data , mail string strange haracter issue comes. such when recieve email spaces converted character Â. not premissible change db encoding. tried following php function no outcome ;( $msg = mb_convert_encoding($msg, "utf-8", "latin1"); please help i check encoding php thinks is echo mb_detect_encoding($str); and do iconv("detectedencoding", "utf-8", $str); or if iconv not installed, check if encoding right in solution. ;)

Error handling using ERRORLEVEL in Windows Batch Script -

we have error handling setup in our scripts shown: set ret = %errorlevel% if %errorlevel% == 0 goto ppcok if not %ret% == 0 goto error1 someone else wrote above, have few concerns working properly. i have read if check errorlevel = 0 checking if errorlevel 0 or higher. assumption go ppcok label? also, examples on web use "if errorlevel 1" or show "if %errorlevel% equ 1" , above uses "if %errorlevel% == 0" wondering if there valid case choosing of these 3 methods should used? on side note not sure why stored errorlevel in variable , used on second if statement rather doing if not %errorlevel% ... batch sensitive spaces in set statement. set flag = n sets variable named "flag space " value of " space n" if errorlevel n true if errorlevel n or greater n . if errorlevel 0 therefore true. if not errorlevel 1 test errorlevel=0. if %errorlevel%==0 , exept former can used within block latter cannot.

android - How to find files quickly? -

i need please! i want make mp3 player on android , therefore need find mp3 files in storage. so search them recursively in mp3 method: private void getmp3files(context context, string directory,arraylist<musiclistarray> mp3_list){ mediametadataretriever mediametadataretriever = new mediametadataretriever(); uri uri; byte[] album_art; bitmap bitmap; /*file[] files = directory.listfiles(new mp3filenamefilter()); files = directory.listfiles();*/ file folder = new file(directory); (file file : folder.listfiles()) { if (file.isfile()) { if (file.getname().endswith(".mp3") || file.getname().endswith(".mp3")) { uri = uri.fromfile(file); mediametadataretriever.setdatasource(context,uri); string artist = mediametadataretriever.extractmetadata(mediametadataretriever.metadata_key_artist); string title = file.getname(); album_art = mediametadataretriever.getembeddedpicture(); i...

c# - Windows Phone 8 show MessageBox when app closing (deactivated) -

i trying show user messagebox before app closed (or deactivated). added both events: if (appsettings.shouldshowalerttransfer) { messagebox.show("..."); } but messagebox not shown. adding because adding background transfers , must inform user created background trasnfers. know can add code onkeybackpressed in every page. it's working key , not middle button. , wouldn't nice have same code copied in every page. so possible show messagebox in app.xaml.cs? how can that? if it's not how can show messagebox when user pressed middle button? i intrigued question opened solution , attempted every single override available , every single page event. tried of methods in app.xaml.cs. i can unequivocally say, based on msdn documentation , own personal testing there no way detect home button press or search button press. furthermore there no way display message box temporarily stop 1 of these actions. ...

javascript - Apply filter to HTML5 video without CSS -

i'm looking way apply filters video (took webcamera in real time), without using kind of css class. i not want create css class like: .blur { -webkit-filter: blur(1px); -moz-filter: blur(1px); -o-filter: blur(1px); -ms-filter: blur(1px); filter: blur(1px); } and apply document.getelementbyid("myvideo").classname = "blur" . no, i'm not looking this. need embed filter video users can quit them. (using injected css not option). to clearify myself: i'm not looking solutions http://html5-demos.appspot.com/static/css/filters/index.html is there way this? thanks edit: i have code post before, have css class assign canvas apply filter whenever want problem? users can disable injected css using developer tools included in chrome, or using firebug (by disabling classes, or elements individually). so need solution apply filters these, without injecting css canvas element. you have apply filters video data before d...

Scriptella: XML to DB: Insert Into from XPATH -

i have xml file looks this: <xml> <table name='test'> <row> <field name='key'>1000</field> <field name='text'>test</field> </row> </table> </xml> id parse xml , use within insert statement: <query connection-id="in"> /xml/table/row <script connection-id="out"> insert x t ( t.entitykey, t.text ) values ( ???????? ); </script> </query> how access specific field-tag within insert statement using xpath? prefer have 1 xsd takes table layouts account , not maintain n xsd each table hence field[@name] design. thanks matthias xpath driver exposes variable called node provides context executing xpath expressions on returned node. can use following expression value of particular field: <script...

r - Panel plot with multiple x variables -

Image
i'd make plot 1 produced below (in either lattice or ggplot2) each panel has different x variable. below solution uses reshape solution don't because require duplicating other columns used other aesthetic mapping (in example, f used color). there way tell lattice (or ggplot2) plot different x variable in each panel doesn't require unnecessary, memory-inefficient, duplication of f variable (as created when reshaping d )? require(ggplot2) require(lattice) require(reshape2) n <- 100 d <- data.frame(y=rnorm(n), f=as.factor(rbinom(n, size=1, prob=.3)), replicate(5, rnorm(n))) d.m <- melt(d, id.var=c("y","f")) xyplot(y~value| variable, group=f, data=d.m) ggplot(data=d.m, aes(x=value, y=y, colour=f)) + geom_point() + facet_wrap(~variable) see how data in f gets duplicated result of melt y f variable value 1 0.5812506 0 x1 -0.08260787 2 -1.1241157 0 x1 -0.24778013 3 1.2121779 0 x1 -0.75744705 4 -0...

mysql - Update a column with the combined results of multiple other columns in the same table -

i'm trying combine results of select single column within same table (moving individual columns storing multiple fields in json object). select query works fine, when try combine update get: you can't specify target table 'app_config' update in clause i'm not sure i'm doing wrong (and i'm not great @ sql), appreciated. combined sql: update app_config set sms_config = ( select concat( '{"user_name":"', app_id, '","user_id":', sms_user_id, ',"user_auth":"', sms_user_auth, '"}' ) app_config sms_user_id not null , sms_user_id > 0 ) i think want. update app_config set sms_config = concat( '{"user_name":"', app_id, '","user_id":' , sms_user_id, ',"user_auth":"', sms_user_auth, '"}') sms_user_id > 0

html - Anything Else Like An Iframe? I want to do Whatever we can do with Iframe -

really, use iframe. because iframe reduce transferring data between server & client. can display static contents in out of iframe & dynamic content in iframe. many developers saying "iframe isn't good". don't know whether it's correct or not. if know iframe please don't forget answer. , need know other ideas such iframe. just use ajax (xmlhttprequest). can send/receive requests client , server without use , problems come iframes.

ios - How to use multiple tracks in an AVMutableComposition -

please see code below. i'm trying add 2nd track have smaller video overlaid on top of background video. can background video display in final exported file. doing wrong? , how control order of tracks, i.e. layering of composition? avmutablecomposition* composition = [[avmutablecomposition alloc] init]; nsurl* backgroundurl = [nsurl fileurlwithpath:backgroundoutputpath]; avurlasset* url0 = [avurlasset urlassetwithurl:backgroundurl options:nil]; avmutablecompositiontrack *backgroundvideotrack = [composition addmutabletrackwithmediatype:avmediatypevideo preferredtrackid:kcmpersistenttrackid_invalid]; avassettrack* bgassettrack = [[url0 trackswithmediatype:avmediatypevideo] objectatindex:0]; [backgroundvideotrack inserttimerange:cmtimerangemake(kcmtimezero, [url0 duration]) oftrack:bgassettrack attime:kcmtimezero error:&error]; nsurl* videourl = [[nsbundle mainbundle] urlforresource: @"star" withextension:@"mp4...

javascript php post undefined -

in following snippet of javascript code, there times when html element scenario not present on php page. when javascript called, value entered in first code line below "undefined". scenario numeric input default value 0, tried check if or not posted html element integer, restore default value. not working. please guide how check , restore default value if html element not present on page. remaining code posts javascript variable php file, updates database , works fine when html element present on page. there different conditions because of html element may or may not present on php page. var scenario = $("#scenario"+tournament_id).val(); if(!isnan(scenario)) { scenario = 0; } check if element exists in dom .length or can use $("#scenario"+tournament_id).is(':visible') if element going be visible in page(if present). if($("#scenario"+tournament_id).length==0 || !$("#scenario"+tournament_id).length) { ...

c# - How to fix - Cannot find object/table in database error when it actually exists? -

i made console c# app in generate sql insert row table info_table , execute it. when use same c# code (with necessary modifications of course) in ssis, error saying table cannot found. error: system.reflection.targetinvocationexception: exception has been thrown target of invocation. ---> system.data.sqlclient.sqlexception: invalid object name 'info_table'. i know there info_table in database , works in console app. so, tried use qualified name in ssis c# script instead of info_table , error went away. why happen , how fix ? doubt if there problem ssis connection string. my ssis connection string (connection manager ado.net type) - data source=.;user id=admin;initial catalog=maximdb;persist security info=true;application name=ssis-datareader-{555000d ddd-aaa-bbb-cccceee}localhost.maximdb.admin; my console app connection string - "server=(local);database=maximdb;integrated security=sspi;"; the c# objects connect database - for console c# ap...

d3.js - chart.xAxis .tickFormat formatting is not working -

i pretty new d3, have spent last 5 hours trying figure out how make works , have tried thousand of combinations. this json want use: var histcatexplong = [ { "key" : "consumer discretionary" , "values" : [ [ 20131201 , 27.38478809681],[ 20131202 , 27.38478809681], [ 20131203 , 27.38478809681]] } , { "key" : "consumer staples" , "values" : [ [ 20131201 , 7.2800122043237],[ 20131202 , 27.38478809681], [ 20131203 , 27.38478809681]] } ]; in dates formatted yyyymmdd . this has been last desperate trial far: chart.xaxis .tickformat(function(d) { var startdate = tostring(d) var parser = d3.time.format("%y%m%d"); var formatter = d3.time.format("%x"); var startdatestring = formatter(parser.parse(startdate)); return startdatestring}); any help, please more welcome! the complete code not working here: <script src="../lib/d3.v3.js"></script> ...

Error creating R data.table with date-time POSIXlt -

problem creating data.table date-time column: > mdt <- data.table(id=1:3, d=strptime(c("06:02:36", "06:02:48", "07:03:12"), "%h:%m:%s")) > class(mdt) [1] "data.table" "data.frame" > print(mdt) error in `rownames<-`(`*tmp*`, value = paste(format(rn, right = true), : length of 'dimnames' [1] not equal array extent enter frame number, or 0 exit 1: print(list(id = 1:3, d = list(sec = c(36, 48, 12), min = c(2, 2, 3), hour = c(6, 6, 7), mday = c(31, 2: print.data.table(list(id = 1:3, d = list(sec = c(36, 48, 12), min = c(2, 2, 3), hour = c(6, 6, 7), m 3: `rownames<-`(`*tmp*`, value = paste(format(rn, right = true), ":", sep = "")) create data.frame , convert data.table works! > mdf <- data.frame(id=1:3, d=strptime(c("06:02:36", "06:02:48", "07:03:12"), "%h:%m:%s")) > print(mdf) id d 1 1 2014-01-31 06...

Does a java:app JNDI name used from within an .ear file require a moduleName component? -

i have ejb packaged in .ear file. this ejb needs reference ejb packaged in different .jar file in same .ear file. the calling ejb not know module target ejb lives in. from reading java ee specification, seems java:app namespace for. think i'm allowed this: final frobnicator f = (frobnicator)context.lookup("java:app/frobnicatorbean"); ...but in glassfish 3.1.2.2 bean name not found. i can see bean deployed , gets global jndi name assigned fine, exists, , bean name ( frobnicatorbean ) above correct. am misreading specification? must specify module name well? if so, java:app namespace? must specify module name well? if so, java:app namespace? according ejb 3.1 specification : 4.4 global jndi access ->4.4.1.1 java:app the java:app prefix allows component executing within java ee application access application-specific namespace. the resulting syntax : java:app/<module-name>/<bean-name>[!<fully...

jquery - How to load CSV to highcharts? -

i have trouble loading csv highcharts. don't know this: http://jsfiddle.net/3bqne/885/ (my code based on: how select columns csv chart highchart? ). sample csv: 1,24,38 3,26,62 4,16,42 5,17,36 and code should show me chart on webpage: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> <script src="http://code.highcharts.com/highcharts.js"></script> <div id="container" style="width:100%; height:400px;"></div> <script> var options = { chart: { renderto: 'container', defaultseriestype: 'line' }, title: { text: 'temperatura' }, xaxis: { categories: [] }, yaxis: { title: { text: 'temperatura' } }, series: [{ data: [] }] }; $.get('data.csv', function(data) { var lines = data.split('\n'); $.each(lin...

Replacing from dictionary - Python -

i'm building program able replace characters in message characters user has entered dictionary. of characters given in text file. so, import them, used code: d = {} open("dictionary.txt") d: line in d: (key, val) = line.split() d[str(key)] = val it works well, except adds "" start of dictionary. array of to-be-replaced text called 'words'. code have that: each in d: words = ";".join(words) words = words.replace(d[each],each) words = words.split(";") print words when hit f5, however, load of gobbledook. here's example: \xef\xbb\xbf\xef\xbb\xbfa+/084& i'm newbie @ python, appreciated. ensure save file in dictionnary file in utf-8. notepad++ (windows) there conversion functions if former file not utf-8. the "" pattern related latin-1 encoding (you won't have if use utf-8 encoding) then, ...

php - htaccess rewrite non html request -

i've migrate dynamic .asp site static site using sitesucker osx app... works done if access directly! old url: http://www.mysite.com/content.asp?l=1&idmen=158‎ new url: http://www.mysite.com/content.asp-l=1&idmen=158‎.html i page not found old referral inbound links (google, yahoo etc...) i like, using .htaccess, redirect links not contains ".html" permanent redirect html page... i've tried not work: rewriteengine on rewritecond %{request_uri} !\.html rewriterule ^(.*)$ $1.html [r=301,l] many frankie as per examples if want modify query string need rule in document_root/.htaccess file: rewriteengine on rewritecond %{query_string} !\.html$ [nc] rewriterule !\.html$ %{request_uri}-%{query_string}.html? [l,r=301,ne]

c# - Circumventing the const requirement of parameters for a custom attribute -

i'm looking ways circumvent restrictions on attribute parameters when creating custom attribute. specifically, have custom displayname attribute goes , retrieves data database , determines display in labelfor helper on view. part of larger prototype, code refinement secondary concern right now. we'll implementing caching , other performance refinements when we're ready start developing actual project. can provide context actual problem, i'm hoping answers general enough apply type of attribute needs this. the constructor doesn't work besides assigning parameters private properties: public displaynametranslationattribute(string pagename = "", [callermembername] string fieldname = "") { _pagename = pagename; _fieldname = fieldname; } all of heavy lifting occurs in displayname override method. reason displayname called every time page loads, opposed constructor called once when page first loaded , never again. public override st...

vb.net - InvalidArgument=Value of '0' is not valid for 'SelectedIndex'. Parameter name: SelectedIndex using ShowDialog -

i have vb6 project have converted on .net using visual studio 2008. have code uses showdialog. code worked fine in vb6. in vs 2008 code doesn't throw error during build or compile. error @ run time, error: an error occurred creating form. see exception.innerexception details. error is: invalidargument=value of '0' not valid 'selectedindex'. parameter name: selectedindex this code error thrown on: frmaddmethod.showdialog() the call stack: prjdrawsafe.exe!prjdrawsafe.frmmain.cmdadddrawing_click(object eventsender = {text = "add drawing"}, system.eventargs eventargs = {x = 59 y = 8 button = system.windows.forms.mousebuttons.left}) line 60 basic can please tell me how fix error code work in .net/? one of controls on converted form has selectedindex property set 0 not supported in .net. there couple of ways sort out: search 'generated form designer code' (or whatever name is) region selectedindex property of...

windows phone 8 - Does the emulator do a full reset on startup -

when emulator closed , reopened in visual studio, full reset? i new programming windows phone , trying make simple program save text file. will saved file deleted everytime new startup of emulator? as msdn says : data in isolated storage persists while emulator running, lost once emulator closes. more info isolated storage, see quickstart: working files , folders in windows phone 8.

symfony - extend YouTubeProvider in SonataMedia -

i'm using sonatamedia, sonataadmin bundle , youtubeprovider upload videos media content. part of sonata\mediabundle\provider\youtubeprovider.php file: //... 'cc_load_policy' => 1, 'wmode' => 'window' //... i want change wmode opaque. can done extend youtubeprovider.php file. what best way that? as there no option specified in advanced configuration documentation page, need override youtube provider, , specify class in config.yml : parameters: sonata.media.provider.youtube: mybundle\myclass sonata_media: providers: youtube: service: sonata.media.provider.youtube

java - modify an array list -

i've been struggling modify array list passed method. can modify array list without creating new array list in method. here problem: write method stutter takes arraylist of strings , integer k parameters , replaces every string k copies of string. example, if list stores values ["how", "are", "you?"] before method called , k 4, should store values ["how", "how", "how", "how", "are", "are", "are", "are", "you?", "you?", "you?", "you?"] after method finishes executing. if k 0 or negative, list should empty after call. one way creating new array list: public static void stutter(arraylist<string> list, int k) { arraylist<string> = new arraylist<string>(); string s = ""; if(k > 0) { for(int = 0; < list.size(); i++) { s = list.get(i); fo...

wordpress - Remove current page from WP Genesis breadcrumbs -

how can remove current page breadcrumbs trail on genesis wordpress site? i've examined breadcrumb.php top bottom, not sure filter(s) should hook into. thanks! bill erickson has snippet remove post title. may worth shot remove current page title well: function be_remove_title_from_single_crumb( $crumb, $args ) { return substr( $crumb, 0, strrpos( $crumb, $args['sep'] ) ); } add_filter( 'genesis_single_crumb', 'be_remove_title_from_single_crumb', 10, 2 ); http://www.billerickson.net/code/remove-post-title-from-breadcrumb/ i'm suprised there isn't more information out there this.

How to generate a uniformly random number U(-1,1) in C#? -

i want generate uniformly distributed random number -1 1 using c#, u(-1,1) in math sign. expected result should real number. user random.nextdouble() , multiply result 2 subtract 1. the code: var rand = new random(); var value = rand.nextdouble() * 2 - 1;

c - printf is causing a segfault with getlogin() -

i'm new c, apologize if answer obvious, i've searched elsewhere. the libraries i'm including are: #include <unistd.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/wait.h> #include <fcntl.h> #include <sys/stat.h> the code failing is: char *user = getlogin(); char cwd[128]; if (user == null) printf("cry\n"); getcwd(cwd, sizeof(cwd)); printf("this prints\n"); printf(user); printf("this not\n"); printf("%s@myshell:%s> ", user, cwd); cry not print, should mean getlogin successful. segfault caused on printf(user); further testing shows folling block prints entirely printf("this prints\n"); printf(user); printf("this prints\n"); but folling block print prints end segfault without showing user printf("this prints\n"); printf(user); edit: sorry wasting t...

matlab - Error when running an exe file within a program -

i have compiled exe file matlab script. exe seem run fine on own. produces wanted output without error message. when run exe-file within program exe file produces following error: too many input arguments error in mclfreestacktrace any suggestion welcome.

c# - How to add a setter when there is a custom getter? -

i have modify existing code , stumped on getter setter. how add setter code? public virtual string sku { { return product.id.trim(); } } depending on want in setter. if want assign value product.id should this: public virtual string sku { { return product.id.trim(); } set { product.id = value; } } in case set private field this: private string _sku; public virtual string sku { { return product.id.trim(); } set { _sku = value; } } but bit akward have setter set field, whereas when getting value different. the natural solution seem be: private string _sku; public virtual string sku { { return _sku.trim(); } set { _sku = value; } } but not know exact rules of business logic.

c# - foreach list<object> in object -

i want make foreach each item in list. doesn't seem possible. or doing wrong? the c# class group public int _id; public string name; public list<subgroups> subs; the c# class subgroup public int _id; public string name; normally this // make group = groups foreach(var g in group) { foreach(var s in group.subs) { // } } but can't call group.subs or @ least won't show. possible? foreach(var g in group) { foreach(var s in g.subs) { // } } you have use variable in outer loop; current variable in iteration.

mysql - Changing .csv field separator using a PHP Script -

i'm working on script connect external ftp, download .csv file , import each record .csv table. i've written script so, have 1 major issue. 1 of columns in .csv file description column which, guessed it, contains commas. this description column wrapped in quotation marks (") i've read solution, column contains measurements, i'd have escape " well. the easiest solution see change field separator uncommon, such | or ^. can tell me if can accomplished in php script? if has alternate suggestion, please let me know, direction here helpful! thanks!

intersection - How to check if two curves intersect in mathematica -

i have set of parametric curves , reference curve, , want see ones intersect reference curve. for example, let's function1's parametric curves , function 2 reference curve. function1[x_,a_]:=x^2+a function2[x]:=1 how can know function1 intersect function2 "in clean way". tried using findroot: in:= findroot[function1[x, 1] == function2[x], {x, 1}] out= {x -> 1.} it works case, in case not work, mathematica provides me absurd value, error message. in[485]:= findroot[function1[x, 4] == function2[x], {x, 1}] "during evaluation of in[485]:= findroot::lstol: line search decreased step size within tolerance specified accuracygoal , precisiongoal unable find sufficient decrease in merit function. may need more machineprecision digits of working precision meet these tolerances. >>" out[485]= {x -> 3.09187*10^-6} instead of having absurd value (in case not intersect) or exact value (in case intersect), "true" or "false...

java - Connect to HornetQ with Apache camel without Spring -

i'm new apache camel. i'm trying connect hornetq queue. i've found several tutorials on use spring. have without spring because project i'm working on doesn't use spring. uses cdi, , i've found this: http://camel.apache.org/cdi.html don't understand how change connects queue. me ?? after long , painful history of trying integrate hornetq camel , employing programmatic solution @ end, turned out @ least hornetq producing can done http4 module. send message payload http4 module hornetq rest endpoint , works fine: http4://hornetqserver:port/hornetq/queues/queuename/create

javascript - changing to Web Workers from AJAX setInterval -

i have script (below) asynchronously updates markup on setinterval ; markup generated jquery xml data. attempt @ creating ui in users can view see changes happen xml data in real-time. however, seeming round way of acheiving desired effect compared web workers api; finding out ajax script , setinterval function unreliable; script appears freeze or not respond @ initial loads , after running long periods of time points . how can modify code use workers instead of ajax or setinterval ? setinterval(refreshxml, 1500); function refreshxml() { var req = $.get('administration/data/people.xml'); req.done(function(xml) { // update global xml variable used create buttons. window.peoplexml = xml; // clear existing buttons. $('#loadme').empty(); // display button each xml person entity. $(xml).find(...

coldfusion - Odd placement of event in schedule -

i have page shows schedule of events on period of time. leigh on site, able working way wanted, except 1 small issue. 1 of events placed @ bottom of 1 of lists sorted datetime column "eventtime". i'm baffled. here's code: <cfquery datasource="fairscheduledb" name="getfairevents"> select fd.fairdaydate, fd.daycolor, fd.description, ev.eventname, ev.eventday, t.eventtype, ev.eventtime fairdays fd left outer join events ev on ev.eventday = fd.fairdaydate left outer join eventtypes t on t.eventtype = ev.eventtype order fd.fairdaydate, t.id, ev.eventtime </cfquery> <cfoutput query="getfairevents" group="eventday"> <div class="schedulebox"> <!--- display event dates ---> <div class="schedulehead" style="clear: both; color: ###daycolor#;">#dateformat(fairdaydate,"dddd, mmmm dd")#</div>...

Mongodb a cluster of machines doing jobs -

i have setup 72 machines take jobs rabbitmq queues , perform crud operations on sharded mongodb on 4 machines , arbeiter, want know if makes difference/sense let 1 machine handle crud operations, running on same network. on side note reason thinking because makes tracking progress easier. four instances light sharded solution, perhaps talking replication ? in mongodb concept of replication used high availability, not performance. minimum recommended configuration 3 nodes, 1 primary, 1 secondary , arbiter. purpose of arbiter being handle elections on node primary, breaking deadlock on 2 nodes handing majority of votes one. more stable replica sets have @ least 3 nodes of primary, secondary, secondary..., , possibly arbiter, arbiter again used have odd number of votes giving majority 1 node in election. in sharded configuration, collection split determined shard key across shards in cluster. main purpose of sharding when data has working set larger available ram on...

How to do POST in Dart command line HttpClient -

i'm struggling putting dart command line client capable of doing http post. know can not use dart:html library , have use dart:io the beginning seems simple: httpclient client = new httpclient(); client.geturl(uri.parse("http://my.host.com:8080/article")); the question is: correct syntax , sequence make httpclient post , able pass json-encoded string post? use http package , dart:convert import 'package:http/http.dart' http; import 'dart:convert'; void main() { var url = 'http://httpbin.org/post'; http.post(url, body: json.encode({'test': 'value'})).then((response) { print("response status: ${response.statuscode}"); print("response body: ${response.body}"); }); } for adding custom headers, handling errors etc. see https://www.dartlang.org/dart-by-example/#making-a-post-request

android - Failure delivering result ResultInfo after taking picture -

i have fragment allows take pictures. of fragments have regular picture, , picture. meaning use 2 different result codes picture taking. error when take use result_picture_extra code , seems random. why getting error when use request_picture_extra ? also, if helps, showing picture in popupwindow , doesn't show up. fragment code private static final int request_picture = 1; private static final int request_picture_extra = 2; private void showextrapicture() { imageview extraimage = (imageview) view.findviewbyid(r.id.extra_image); if (step.getisreqpicturefinished()) { try { fileinputstream fis = getactivity().openfileinput(step.getextraimagefilename()); bitmap imgfromfile = bitmapfactory.decodestream(fis); fis.close(); extraimage.setimagebitmap(imgfromfile); extraimage.invalidate(); } catch (filenotfoundexception e) { e.printstacktrace(); } catch (ioexception e) { e.pr...

file - c++ error c2373 redefinition different type modifiers -

when run program, error. c++ error c2373 'readbalance' redefinition different type modifiers i want read in file write. // readandwrite.cpp : defines entry point console application. // #include "stdafx.h" #include <iostream> #include <fstream> using namespace std; double readbalance; double balance; int main () { double readbalance(); double balance = 0; ifstream readfile; readfile.open("renatofile.txt"); char output [100]; if (readfile.is_open()) { while(!readfile.eof()) { readfile>>output; } } readfile.close(); balance=atof(output); return balance; } can because i'm returning balance? i'm guessing wanted define readbalance function , call main, this: #include "stdafx.h" #include <iostream> #include <fstream> #include <cstdlib> // need atof using namespace std; double readbalanc...

Data from WebForm not being entered into Database (MySQL) PHP -

i have built website have built registration form. have managed connection no errors, data isn't being entered form database. code have php below... $dbhost="refereelink.mysql"; $dbuser=" "; $dbpass=" "; $dbname="refereelink_com"; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die (mysql_error()); mysql_select_db($dbname); if (isset($_post['add'])){ $firstname = $_post['firstname']; $surname = $_post['surname']; $dob = $_post['dob']; $city = $_post['city']; $r_country = $_post['r_country']; $r_region = $_post['r_region']; $r_level = $_post['r_level']; $r_email = $_post['r_email']; $r_contact_n = $_post['r_contact_n']; $r_username = $_post ['r_username']; $r_password =$_post['r_password']; $membership_type =$_post ['me...