Posts

Showing posts from March, 2012

html - Create drop down menu without ul inside li -

i want create drop down menu faced problem: actually want create without making <ul> tag inside <li> tag code : <!doctype html> <html> <head> <meta charset=utf-8 /> <title>js bin</title> </head> <body> <ul> <li><a>coffee</a></li> <ul><li><a>coffee 2</a></li></ul> <li><a>tea</a></li> <li><a>milk</a></li> </ul> </body> </html> and css code : ul { font-family: arial, verdana; font-size: 14px; margin: 0; padding: 0; list-style: none; z-index: 1; } ul li { display: block; position: relative; float: left; } li ul { display: none; } ul li { display: block; text-decoration: none; color: #ffffff; border-top: 1px solid #ffffff; padding: 5px 15px 5px 15px; background: #1e7c9a; margin-left: 1px; white-sp

vb.net - Form keydown event and textbox keydown event -

private sub accounttype_keydown(sender object, e keyeventargs) handles mybase.keydown if e.keycode = keys.return processtabkey(true) end if end sub private sub anytextbox_enter(sender object, e eventargs) handles twitter.enter, email.enter, phonenooffice.enter, phonenohome.enter, phonenomobile.enter, ename.enter, aname.enter, idcode.enter, expirydate.enter, bankaccount.enter dim txt textbox = directcast(sender, textbox) stroldvalue = txt.text end sub private sub anytextbox_keydown(sender object, e keyeventargs) handles twitter.keydown, email.keydown, phonenooffice.keydown, phonenohome.keydown, phonenomobile.keydown, ename.keydown, aname.keydown, idcode.keydown, expirydate.keydown, bankaccount.keydown dim txt textbox = directcast(sender, textbox) if e.keycode = keys.enter or e.keycode = keys.tab if txt.text <> stroldvalue connectunauth() cmd = new sqlcomma

In Python, sys.path.append('path/to/module') throws syntax error -

i trying append module path pythonpath environment variable import sys sys.path.append(0,"/path/to/module/abc.py") i getting syntax error syntax error: word unexpected (expecting ")") can me correct syntax sys.path.append() ? both answers correct. append() default adds argument end of list. it's throwing syntax error passing 2 arguments , accepting 1. judging syntax want path added front of path insert() method use. you can read more in documentation on data structures list.append(x) add item end of list; equivalent a[len(a):] = [x]. list.insert(i, x) insert item @ given position. first argument index of element before insert, a.insert(0, x) inserts @ front of list, , a.insert(len(a), x) equivalent a.append(x) . import sys # inserts @ front of path sys.path.insert(0, "/path/to/module/abc.py") # inserts @ end of path sys.path.append('/path/to/module/abc.py')

Alias option in SQL Query -

select b.test_id,d.test_id test b, test d what result on stated query. either both columns result same 1 or different? you have cartesian product a.k.a cross join of rows. the cross join not apply predicate filter records joined table. for rows 1, 2, , 3 in test this: 1,1 1,2 1,3 2,1 2,2 2,3 3,1 3,2 3,3

how to enable linux support users for a certain no of hrs using php -

i want enable linux support user 8 hours , lock login automatically. front end built using php , below have used .. // enabling support shell_exec("sudo passwd -u support"); // time expire $date = date("h:i:s a", strtotime('+8 hours')); $timeat = substr($date,0,2).substr($date,9,11); // cron setup using 'at' command shell_exec("sudo @ ".$timeat." -f /path/to/cron/disablesupport.php"); disablesupport.php has below code. //locking support shell_exec("passwd -l support"); this didn't work. please fix , me solution. revise php.ini file custom time configuration. for ubuntu, /etc/php5/apache2/php.ini file should revised. change line: session.gc_maxlifetime=28800 (28800 seconds = 8 hours)

header displaying a notice in php mysql -

i have header.php include nav bar using session transfer stored data problem browser keep display error message: a session had been started - ignoring session_start() in c:\wamp\www\new adamkhoury\header.php on line 2 header.php <?php session_start(); ob_start(); /*if($_session['login'] != 'true'){ header("location:index.php"); }*/ //var_dump($login_user); require_once('include/connect.php'); $id = ($_session['user_id']); $username= ($_session['user_name']) ; var_dump($username); var_dump($id); ?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <link href='http://fonts.go

javascript - Not getting onchange event of dynamicly added dropdown in mvc3 -

i have 3 dropdownlists. $(document).ready(function () { $("#dropdownlist1").change(function () { $("#id1").val($(this).val()); $("#name1").val($("#dropdownlist1 option:selected").text()); $('#div1').load('/account/dropdown2/?id1=' + $("#id1").val()); }); $("#dropdownlist2").change(function () { $("#routeid").val($(this).val()); $("#routename").val($("#routedropdownlist option:selected").text()); $('#div2').load('/account/dropdown3/?id2=' + $("#routeid").val()); }); $("#dropdownlist3").change(function () { $("#id3").val($(this).val()); $("#name3").val($("#dropdownlist3 option:selected").text()); }); }); in dropdownlist2 , dropdownlist3 added dynamicly.the prob

android - JSONObject Serialization -

hello there method serialize jsonobject having required request data hitting web service. have read jackson, gson library not find way because have serialize jsonobject not java object. i new android development , not being able figure out how can done. thanks in advance. you can serialize string reppresenting jsonobject . the tostring() implementation of jsonobject returns need. here doc

html - Full width drop down -

i have gone online , found looking drop down menu , have been trying edit code drop down menu 100% of width of screen , inside ill have wrap hold links @ width of 960px. im unable drop down 100%. http://jsfiddle.net/jwspz/ i think problem in here somewhere... ul li ul { padding: 0; position: absolute; top: 48px; left: 0; width: 150px; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; display: none; opacity: 0; visibility: hidden; -webkit-transiton: opacity 0.2s; -moz-transition: opacity 0.2s; -ms-transition: opacity 0.2s; -o-transition: opacity 0.2s; -transition: opacity 0.2s; } that drop down i've been trying edit. want similar drop down http://au.beatsbydre.com/ i have managed width of menu witch think want, working demo i added following (so simple) code removed ul li{ position:relative; } and added ul{ position:relative; } if want full width of screen remove ul li{ position:r

.htaccess - 301 redirection - front page to subdirectory -

i needed redirect od domain new one. paths same on both domains except front page, needed redirected www.mydomain.com www.mydomain2.com/newpath. googled , came code works. question if valid , if pageranks transfered without problems. thank you rewriteengine on rewritecond %{http_host} domain\.com [nc] rewritecond %{request_uri} ^/$ rewriterule ^(.*)$ http://www.domain1.com/folder/ [l,r=301] rewriterule ^(.*)$ http://www.domain1.com/$1 [l,r=301] your code should work can fine tuned bit. please consider refactored code: options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase / rewritecond %{http_host} ^(www\.)?domain\.com$ [nc] rewriterule ^$ http://www.domain1.com/folder/ [l,r=301] rewritecond %{http_host} ^(www\.)?domain\.com$ [nc] rewriterule ^ http://www.domain1.com%{request_uri} [l,r=301]

php - Get specific tag from api code -

i want img src tag following code: <pod title="scientific name" scanner="data" id="scientificname:speciesdata" position="200" error="false" numsubpods="1"> <subpod title=""> <plaintext>canis lupus familiaris</plaintext> <img src="http://www4a.wolframalpha.com/calculate/msp/msp17941cd1c5fi21h72ac2000057i1ae7gc4986gdf?mspstoretype=image/gif&s=44" alt="canis lupus familiaris" title="canis lupus familiaris" width="139" height="18"/> </subpod> </pod> i know how plaintext information how img src information? here's have plaintext information: <?php if(isset($_post['q'])){ include 'wolframalphaengine.php'; $engine = new wolframalphaengine( 'app-id' ); $resp = $engine->getresults("$q"); $pod = $resp->getpods(); $pod1 = $pod[1]; foreach($pod1->getsubpods() $subpod){

Check for window dimensions in PyGame / SDL -

is there way window's dimensions other pygame.display.info() or surface pygame.display.set_mode() returns? i'm developing piece of software resizable window. while setting default dimensions ok window managers out there, tiling ones (such awesome, xmonad, etc) agressively fit window dynamic size of choice. refitting happens fast after sdl creates initial window, doesn't generate pygame.videoresize event new (correct) dimensions. now things work if @ start generate bogus videoresize event new size of 0: p.event.post(p.event.event(p.videoresize, size=(0,0), w=0, h=0)) at least xmonad see , resize again size. have hunch won't pretty traditional window managers. window gets cover of screen estate. is there better way determine frame sizes? under pygame.event.get() there event.size, event.h , event.w , retrieves windows dimensions so example re-sized background color calling even.w,event.h because otherwise screen re-size white square. can use lis

backbone.js - Backbone view in not rendering from collection.toJSON() -

i using backbone, handlebars, jquery app. following code line not working this.$el.find('.quiz-container').append(quiz.tmplt.result(this.collection.tojson())); template is <h2 class="score">congratulation abcd! have scored {{score}} !!!</h2> <table> <thead> <tr> <th>question</th> <th>your answer</th> <th>correct answer</th> </tr> </thead> <tbody> {{#each qtext}} <tr> <td>{{this}}</td> <td> {{#each ../answer}} <span>{{this}}</span> {{/each}} </td> </tr> {{/each}} </tbody> </table> here json file [{ "qid": "1001", "qtext": "this question one?", "options": [{"

java - Hibernate persisting an Object member -

is there way persist entity member of type java.lang.object ? lets have entity dynamicproperty has members private string name; private object value; value can of several types non complex ones (string, boolean, integer, decimal, enum...) is there way doing ? , db(oracle) column type should . if they're basic types, can try store them strings , cast them right classes in getter. there's option - can create class hold value type , have fields of necessary types, 1 being set though. like class foo { integer a; double b; string c; int type; //getters , setters public object getobject() { if (type == 1) return a; else if (type == 2) return b; return c; } } it's bit of workaround, should work. think isn't possible persist object abstract. also, take @ @embedded annotation, may help.

playframework 2.0 - How to access credentials passed in the authentication popup for a 401 response -

i need implement activedirectory based authentication on site developin gusing play framework. demo, created sample app public static result index() { boolean isloggedin = false; string authorization = request().getheader(authorization); if(!isloggedin) { string usrnm = request().username(); response().setheader(www_authenticate, "basic realm=\"enter id , password\""); return unauthorized("you need login first"); } return ok("welcome nowhere"); } this opens authentication popup on client. now, how access these credentials? ok, found answer string authorization = request().getheader(authorization); the authorization header contains username:password in base64 encoded form. authorization = "basic oa76dfexvdd3==" here, if decode oa76dfexvdd3== , "myusr:mypwd", can use authentication.

html - Vertically adjusting wrapped divs using jquery toggle -

i have set of divs being built dynamically , include several rows of content. restricting output 3 columns per row. using jquery toggle toggle content within div, attempting move each of divs below (in vertical manner) allow room of reading toggled element. have attempted using following markup: <script type="text/javascript"> $(".trigger").click(function () { var trigger = $(this); $(this).next(".toggle").slidetoggle(); }); </script> <div id="togglecontainer"> <div> <h3 class="trigger">trigger 1</h3> <ul class="toggle"> <li>line one</li> <li>line two</li> <li>line three</li> </ul> </div> <div> <h3 class="trigger">trigger 2</h3> <ul class="toggle"> <li>line o

sqlite jdbc setJournalMode -

i running first trials on sqlite (with jdbc) pure memory database. need fast inserts tried set config accordingly. find out code below fails @ setting journalmode. please refer method shown below. variables con , isconnected defined class vars , not shown here. thanks lot rolf public boolean connect() { try { class.forname("org.sqlite.jdbc"); // sqlitejdbc_3.7.2 // set pragmas sqliteconfig config = new sqliteconfig(); // statement (journalmode setting) causes fail // without statement connection can established // ==> java.sql.batchupdateexception: batch entry 0: query returns results config.setjournalmode(journalmode.memory); config.settempstore(tempstore.memory); config.setsynchronous(synchronousmode.off); config.enforceforeignkeys(false); config.enablecountchanges(false); con = drivermanager.getconnection("jdbc:sqlite::memory:", co

eclipse - Why do hashCode & equal need non-static fields to be generated? -

Image
i curious error while testing out eclipses' functionality: i tried use command "generate hashcode & equals", because class has static methods rejected it. how work(i.e. hashcode/equals needing non-static methods ? )? thank you hashcode , equals methods belonging concrete object , need members belonging object compute meaningful value. eg. if want compare 2 instances of same class, comparing "computed values" through equals and/or hashcode methods. static methods , members belong class , not concrete instance uniquely.

excel - Spring MVC / AbstractExcelView / Apache POI : File Error -

i'm using apache poi , extending springs abstractexcelview create excel sheets. public class excelspreadsheetview extends abstractexcelview { protected void buildexceldocument(map<string, object> model, hssfworkbook workbook, httpservletrequest request, httpservletresponse response) throws exception { //get positions loop through model @suppresswarnings("unchecked") list<position> positions = (list<position>) model.get("positions"); int lastrow = 0; mysheet = wb.createsheet("sheet1"); myrow = mysheet.createrow(lastrow); mycell = myrow.createcell(0); //loop through positions (int p = 0; p < positions.size(); p++) { myrow = mysheet.createrow(lastrow); mycell = myrow.createcell(0); mycell.setcellvalue(new hssfrichtextstring(positions.get(p).getpositionname())); lastrow++; } //response stuff goes here, shouldnt need } i can create sheet when have following code after poi code:

coffeescript - Dynamically insert ruby generated HTML -

i have form user can elect create more input areas (to provide more information). have link user click on , form inputs created. i'd use rails form helpers don't have write html myself. i've tried inserting form helpers directly coffeescript , saving outputted html data tag on link, can't coffeescript execute ruby code , i'm having escaping issues data attribute. here's form: = simple_form_for([@site, @zone]) |f| = f.error_notification .form-inputs = f.input :site_id = label_tag "x" = text_field_tag 'x_coords[]' = label_tag "y" = text_field_tag 'y_coords[]' = label_tag "x" = text_field_tag 'x_coords[]' = label_tag "y" = text_field_tag 'y_coords[]' = label_tag "x" = text_field_tag 'x_coords[]' = label_tag "y" = text_field_tag 'y_coords[]' = link_to "add point", "#&

ruby on rails - undefined method relative_url_root for nil:NilClass when running rspec on namespaced controller -

i'm working on rails 2.3.18 3.2.x upgrade, , i've run problem 1 set of controller tests: error: /actionpack-3.2.12/lib/action_controller/test_case.rb:514:in `build_request_uri' /actionpack-3.2.12/lib/action_controller/test_case.rb:470:in `process' /actionpack-3.2.12/lib/action_controller/test_case.rb:49:in `process' /actionpack-3.2.12/lib/action_controller/test_case.rb:390:in `get' # ./spec/controllers/integrations/formstack_controller_spec.rb:104:in `block (3 levels) in <top (required)>' code triggering error: it "should handle failed access_token retreival" formstack::oauth2connection.any_instance.stub(:identify).and_return(nil) "oauth_token" # line <---------------------------------------------------------------- 104 response.should redirect_to(:controller => "/integrations/", :action => :index) flash[:error].should include("error") end the routes controller: namespa

call asp.net method from jquery dialog button -

i tying create delete confirmation dialog. here's jquery dialog $(function () { $("#del-dialog").dialog({ autoopen: false, width: 300, height: 100, modal: true, close: function (event, ui) { location.reload(false); }, buttons: { 'delete': function () { $(this).dialog('close'); // delete function goes here }, 'cancel': function () { $(this).dialog('close'); } }, }); $(".icon-del").click(function (event) { event.preventdefault(); $("#del-dialog").dialog("open"); }); }); and asp code: l += "<a onclick='hello("; l += dr["cid"].tostring(); l += ");'>"; l += "</a>"; how handle delete funct

Java: System.arraycopy is not copying my arrays -

i have array called "first" , array called "second", both arrays of type byte , size of 10 indexes. i copying 2 arrays 1 array called "third" of type byte , of length 2*first.length follow: byte[] third= new byte[2*first.length]; for(int = 0; i<first.length;i++){ system.arraycopy(first[i], 0, third[i], 0, first.length); } for(int = 0; i<second.length;i++){ system.arraycopy(second[i], 0, third[i], first.length, first.length); } but not copying , throws exception: arraystoreexception i read on here exception thrown when element in src array not stored dest array because of type mismatch. arrays in bytes there no mismatch what problem ? you pass system.arraycopy array , not array element. passing first[i] arraycopy first argument, you're passing in byte , (because arraycopy declared accepting object src argument) gets promoted byte . you're getting arraystoreexception first reason in list in the

scripting - Create Local User with Custom User Folder in Powershell -

i trying create new win 2008 server local user , assign user different profile path. don't want windows generate files under c:\users\newuser, instead, i'd have in d:\customdir\newuser. know of way this? so far have: $users= @("u1","u2","u3") $computer = [adsi]"winnt://$env:computername,computer" $group = [adsi]"winnt://$env:computername/mycustomgroup,group" $users | foreach { $username = $_ $userpath = "d:\customdir\$username" echo "creating $username..." $user = $computer.create("user",$username) $user.put("description","user $username description") #$user.put("profilepath",$userpath) #this not work, throws error #$user.put("homedirdrive","d:") #this appears ignored when uncommented $user.setpassword($username) $user.setinfo() $group.add($user.path) #run cmd user account create profile files/f

javascript - Load content to title from tag -

i wanted load (replace) text <h2> <h2>text</h2> to <title>here!</title> how can it? when replacing classes used $(".value").load ... don't know how tags. thanks you can set title using document.title property. setting title content of h2 tag use: document.title = $('h2').text(); without jquery var element = document.getelementsbytagname('h2')[0]; if (element.textcontent) { document.title = element.textcontent; } else { document.title = element.innertext; // ie < 9 }

mdf - Cannot connect project to a SQL Server database -

i have problem while trying copy project folder hard drive. project in visual studio defined in h:\ , while run exe file project no problem while copy folder project hard drive have problem connect application sql server. see these screenshots: http://upload.tehran98.com/img1/f9kio8ssjofg1lhkjdg.jpg http://upload.tehran98.com/img1/k6ajdb22xhdjrgcn419.jpg for example in login form , in login button code is: private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click dim conn new sqlconnection("server=.\sqlexpress;attachdbfilename=" + environment.currentdirectory + "\database\automation.mdf;database=automation;trusted_connection=yes;") s2 = "select count( * ) login username = '" & textbox1.text & "' , password = '" & textbox2.text & "'" dim com new sqlcommand(s2, conn) dim res object conn.open() res =

php - set two parameters in a query builder symfony -

i want set 2 parameters $type , $superior in query builder $qb->select('a') ->from('xxxbundle:entity', 'a') ->where('a.typepro = :type') ->andwhere('a.superior=: superior') ->setparameter('type', $type) ->setparameter ('superior',$superior); but failed appropriate result , following exception : invalid parameter format, : given, : or ? expected. any ideas? there space between ':' , parameter name: ->andwhere('a.superior=: superior') instead, should be: ->andwhere('a.superior = :superior')

internet explorer - VS2012 breaks previously functioning .NET ActiveX object in IE 8 -

(yes, work in large corporate environment, why i'm talking of backwards technology. no, don't have option gut thing , rewrite in decade's technology.) we have application needs client-side work in .net, needs launched web application. way dev (working in 2004ish) chose have web site output tag points @ .net dll on server , launches winforms usercontrol inside of dll. the html gets rendered in web page looks this: <object id=launcher classid=http://server.com/path/to/the.dll#full.namespace.path.to.theusercontrol width=640 height=300 viewastext> <param name="someparam" value="someparamvalue"> </object> this working in production many years. now, when our developers install vs2012, stops working. after 2012 install, see user control rendered in box inside of ie page, see big x (like broken image). no other feedback given might problem. note true whether dev runs code locally, or runs on server deployed users (and

ETW ProcessTrace() trying to reserve 1GB of memory on XP? -

Image
i'm writing application uses nt kernel logger via etw trace functions. consumes in real-time mode. works fine on windows 7 test machine on xp vm getting regular out of memory exceptions. using apimonitor (amazing tool btw) tracked down call ntallocatevirtualmemory() processtrace() win32 api call itself. trying allocate 1gb of contiguous memory, can seen in screenshot. has encountered before? cannot conceive why need allocate memory. additionally, call occurring deep within processtrace() call stack in undocumented win32 api function (wmimofenumerateresourcesa()), seems i'm not going able influence it. has encountered before? i'd appreciate potential solutions. i need support xp/2003 , on 32-bit versions can't assume 1gb of contiguous memory available. real-time processing requirement. however, workarounds using file-backed logging doesn't involve losing events consider e.g. i'd "real-time" process new events added .etl files instead, if pos

javascript - Django spinner when loading (spin.js) -

i new in django , things, , need tips or solutions adding spinner. iam using spin.js, show on way: var target = document.getelementbyid('spin'); var spinner = new spinner(opts).spin(target); spinner.stop(); function spin_stop() { spinner.stop(); } function spin_start() { spinner.spin(target); } this code copied example on web. show spinner <div id...> now there problem. i have app in django name testscript. app connects different page verify login information. "long" process, takes 10sec. in time, want on login page add spinner. in template have form: <form class="form-signin" action="/testscript/" method="post"> and if want add onclick event in button in form, spinner freeze. how can show spinner, when testscript processing? thanx the spinner freezes because browser has changed page , waiting new page respond. you try using an animated gif spinne

Cakephp passing a parameter from index page -

is possible pass value variable in index page? for example, "/app/user/1" in controller, want this public function index($id = null){ ... } in cakephp, give error , saying "error: action 1 not defined in controller" that error because you're missing action part of url try /app/users/index/1 note plural on controller part. $id passed action want that.

Read a term-document matrix from csv using python -

the reason classic csv reader doesn't work on term-document arrays first column of csv file terms, not values. file has following syntax: "";"label1";"label2";"label3" ... "term1";1;0;8;... "term2";0;0;3;... ................................. i need build dictionary keys label1, label3, etc... , values column vectors (here be: dict[label1]-> 1,0 , dict[label2] -> 0,0 etc), meaning terms useless me. i have implemented custom solution goes this: .... keys = f.readline().split('";"') #1st line of csv keys = keys[1:] #skipping "" zeros = [0] * len(keys) #dicts initial values 0 d = ordereddict(zip(keys, zeros)) lines = f.readlines() line in lines: ... splittting, stripping etc list values (eg: 1,0,8 - see example above) ... value in values: .... however reading 8 csv files (total: 12mb) takes on 90 minutes laptop. does know more e

qt - Compile a kernel module using qmake project -

i have following project structure: / general.pro a/ a.pro files b/ b.pro files c/ makefile files general.pro template=subdirs style qmake-project. 2 other project files normal/common qmake project files (folder , b). third folder (folder c) contains kernel module following makefile : http://pastebin.com/bv39d6kk i'm wondering if makefile can translated somehow qmake project file. if not, there way the general.pro project file there "c" folder containing makefile should ran too? regards i doubt, can include makefile in .pro file. here thoughts can do: if c project, create 1 more .pro file it. if not, , don't need edit it, build without including subdirs (if it's library, using in a or b , still can build it, , create .pri file , add includes , libs etc). if need build machine or deploying, use build script. you use cmake . update : it turns out, there solution.

c++ Read from .csv file -

Image
i have code supposed cout in console information .csv file; while(file.good()) { getline(file, id, ','); cout << "id: " << id << " " ; getline(file, nome, ',') ; cout << "user: " << nome << " " ; getline(file, idade, ',') ; cout << "idade: " << idade << " " ; getline(file, genero, ' ') ; cout << "sexo: " << genero<< " " ; } and csv file has (when open notepad): 0,filipe,19,m 1,maria,20,f 2,walter,60,m whenever run program console display this: my question why isn't program repeating cout messages in every line instead of in first 1 btw , nome name, idade age, , genero/sexo gender, forgot translate before creating post you can follow this answer see many different ways process csv in c++. in case, last call getline putting last

vbscript - HTML VBS Special Character handling -

i have file uses website specific query , returns data needed via html headers. when writing returned data file sql query supplied works fine. if query has special characters in it, stops @ point. examples of characters cause problem "?", "~", "_". have tried find several work arounds data coming have yet determine new means functions. this how exporting data when comes back: set objexportfile = objfso.opentextfile(exportfilelocation, 8, true, -1) objexportfile.writeline(objhead.responsetext) objexportfile.close thanks, you this dim badchar(2) dim char dim header badchar(0) = "?" badchar(1) = "~" badchar(2) = "_" header = objhead.responsetext each char in badchar if instr(header, char) header = replace(header, char, "") end if next set objexportfile = objfso.opentextfile(exportfilelocation, 8, true, -1) objexportfile.writeline(header) objexportfile.close

php - Passing data from View to Controller for sql statement in Model in CI -

hi have simple form of images user can click on , depending on image clicked on modal dialog appear list of data database. have working 1 whereby state specific column name in mysql statement not via variable. able know how/where pass value of image input view controller can used in mysql statement in view..i pass mysql statement controller model view. below code. appreciated brand new ci , abit confused.thanks! controller: <?php if ( ! defined('basepath')) exit('no direct script access allowed'); class app extends my_controller { function __construct() { parent::__construct(); log_message('debug', 'app controller has been initialized'); } public function toolsmodal() { $dept = $this->input->post('submit'); //echo $dept; $this->load->model('tools_model'); $tools = $this->tools_model->gettools($dept); $data['tools'] = $tools; $data['view'] = 'dat

c# - What is the best practise for handling complex objects as class members? -

okay, basic example have application expenses , each expense in sql database has id, employee id , amount. should this: public class expense { public int id { get; set; } public employee employee { get; set; } public decimal amount { get; set; } } or this: public class expense { public int id { get; set; } public int employeeid { get; set; } public decimal amount { get; set; } } you see first , when fetch expense database set employee field calling constructor like: employee = new employee(int id) make trip db complete members in employee object. handy because can access employees members/functions via expense.. i.e. if bound objectdatasource display eval("employee.name") , show more friendly number stored in db. however current project i'm working on may run 10's of thousands of rows , number of db requests going sky rocket if i'm fetching first expense details , employee details each object. (and in fact current project ha

documentation - Continuous user manual generation -

are there solutions existing "continuous documentation", e.g. documentation markup languages , build plugins jenkins/hudson? i'm not talking generating api description, user manuals screenshots, etc. keeping user manual up-to-date tedious job, thought idea write user manual in markup (xml) , have transformed html , pdf during build process. this quite straightforward implement, wondering if there solutions or best practices existing, e.g. sphinx , maybe in javas i'm not allowed use python. unfortunately there not many choices in pure java world: for simple manuals use markdown , java implementation f.ex. pegdown ; works simple html manuals pdf generation difficult. if have sphinx-documentation use restructuredtext-java implementation jrst (not powerfull sphinx) or run sphinx jpython... the best solution in opinion write document in asciidoc . since few weeks there exists a java-wrapper (which use jruby) ruby port named asciidoctor . the asc

actionscript 3 - Action Script 3. Timer starts count when I'm in menu, but game not started -

i'm creating flash game , strange problem. timer starts count when i'm in menu, game not started. in menu have button "play", after clicked add timer, shows how long program running (start count current time). this main function starts public function memorygame() { startmemorygame.addeventlistener(mouseevent.click, startplay); } this button start game: function startplay(e:mouseevent):void { startmemorygame(); } and here function timer , other objects added. function startmemorygame():void { timer = new timer(1000); //create new timer ticks every second. timer.addeventlistener(timerevent.timer, tick, false, 0, true); //listen timer tick timer.addeventlistener(timerevent.timer, resettimer); txttime = new textfield(); var format:textformat = new textformat(); format.font = "verdana"; format.color = &

magento - Add attribute to sales->order->Create new order -

i want add new attribute in magento admin panes: > sales > order > create new order i want sales persons name fetched current user login in admin panel. order type drop down , referred drop down. please tell me how move ahead it? files edit , on details properly? firstly need create new attribute on order entity: $installer = new mage_sales_model_resource_setup('core_setup'); $installer ->addattribute('order', 'my_attribute', array( 'label' => 'my new attribute', 'type' => 'varchar', 'input' => 'text', 'visible' => true, 'required' => false, 'position' => 1, )); now need modify admin view show new attribute: app/design/adminhtml/default/default/template/sales/order/view/info.phtml <?php if($_order->getmyattribute()): ?> <tr> <td class="label"><label><

php - How To: URL Rewrite & HTML Link Within Same Page? -

i want user click on link of www.domain.com/how-it-works my url rewrite is: rewriterule ^how-it-works/?$ index.php?action=about&link=howitworks [nc] index.php gets "action" , "link" parameters, , lost... i using following: require( template_path . "/about.php" ); this loads about.php template file, want, put "same page link" of: #hiw? #hiw link inside about.php template file. the #hiw in url called fragment identifier in html . supposing using apache, can go (note ne , r flags @ end): rewriterule ^how-it-works/?$ index.php?action=about#hiv [nc,ne,r] (i took of &link=howitworks because suppose #hiv replaces it, if not can put back) http://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_ne

php - Pdo Error Catching Try/Catch -

after looking using try catch blocks pdo statements benefit? slow code down? i believe there should try catch around connection command in case database connection fails. there need try catch around each pre prepared statement? these should never change , never error out. any thoughts? i'm using php , mysql. there no benefit this: try { // exec statement // exec statement } catch (exception $e) { // nothing } if aren't going error , provide reasonable solution, may let exception bubble application's main "something went wrong" error page. but may want this: // begin transaction try { // exec statement // exec statement // commit transaction } catch (exception $e) { // rollback transaction // handle error or rethrow $e; } and prepared statements can throw exceptions. perhaps unique key violated, or foreign key constraint is, etc. but main point is, don't use exceptions hide or silence errors. use them catch error,

ffmpeg - Can't record S-Video with avconv -

i've been trying record feed s-video cable using avconv. able record composite video avconv, quality isn't best. set input, use v4l2-ctl -i $n , $n either 0 composite, or 1 s-video. tried use v4l2-ctl -i 1 set input, doesn't work. oddly enough, when use tvtime or qv4l2 can view video. i able record audio, not video. in tvtime can audio video. also, able record s-video ffmpeg using -channel option. ffmpeg, btw, can't record audio, , recording separate audio isn't option. edit: per anton's request, here's command use capture video avconv. avconv -f video4linux2 -i /dev/video0 -f alsa -i hw:2,0 -vcodec mpeg4 -vtag xvid -b 8000k -r 30000/1001 -acodec \ libmp3lame -ar 48000 -ac 2 -ab 192k -aspect 16:9 -vf yadif=0,scale=1200:800 -y test.avi and here's output command: avconv version 0.8.6-6:0.8.6-0ubuntu0.12.10.1, copyright (c) 2000-2013 libav developers built on apr 2 2013 17:02:16 gcc 4.7.2 [video4linux2 @ 0x982340] estimating dura

php - Will the "get_current_user()" function work on Linux/OSX? -

i learned php morning , i'm writing simple php script planning use scheduled task everyday. script working fine features want add later on, use get_current_user() function from. my question is: is get_current_user() cross-platform compatible? i'm not entirely sure because i'm still new scripting language. appreciated. thank you! get_current_user work on posix based systems (linux, mac, etc) make sure understand function does. returns owner of script (file), not process owner . if script file owned root, run user "jamie", get_current_user() return root. to process owner, use snippet first comment in get_current_user php docs <?php $processuser = posix_getpwuid(posix_geteuid()); print $processuser['name']; ?>

express - Node.js change url base with prefix -

i have node.js app express , jade templates. i've running any-host:8000 need change any-host:8000/web/ causes change href , location css,img,js... any idea achieve transparently i've tried with: app.namespace('/admin', function(){...} but need change href of html links in app. any suggestions? app.use('/urlbase', express.static(__dirname + '/public')); (assuming app located in myapp/ ).

javascript - asp:Button in jQuery dialog box not firing OnClick event -

i have asp:button inside jquery dialog onclick event isn't firing. i'm using postbackurl property navigate page, want set property in onclick event can append query string variable according name of file upload in dialog. posted question dialog earlier, because couldn't post @ all, that's been fixed. clicking button posts fine, , can set postbackurl property in asp markup, or in page_load() of code behind. can't onclick function fire reason, , that's want set postbackurl . here's .aspx... <form id="frmdialog" runat="server"> <asp:button id="btndisplaydialog" runat="server" text="click display login dialog" onclientclick="showdialog(); return false;" /> <div class="divinnerform"></div> <div class="divdialog" style="display: none"> <table style="width: 100%;">

google maps API v3 events -

i have following situation: a polyline added on map , when user clicks on state changes editable. have event if user clicks last vertext of polyline , starts moving mouse able extend polyline mouse path user drawing. however seems when have event , inside event try add 1 not work , don't kwow why. just in case make things simpler undrstand paste part of code. google.maps.event.addlistener(polyline, "mousedown", function(event){ if(polyline.geteditable() === true) { if(typeof event.vertex !== "undefined") { if(event.vertex === polyline.getpath().getlength() - 1) { polyline.seteditable(false); if(mousemovedrawingevent === null) { map.setoptions({draggable:false}); polyl

c++ - returning a derived class object through a pointer of its abstract base class -

i must write program in 1 of function return derived class via abstract base class, when class being returned main may access derived class virtual methods. please keep in mind can't change in main program since not 1 writing it. #include<iostream> using namespace std; class { private: public: virtual void doit(void)=0; a(void){}; ~a(void){}; }; class b: public { private: int num; public: virtual void doit(void){num=7;cout<<"its done";}; b(void){}; ~b(void){}; }; a& returnvalue(void) { b item; return item; } void main() { a& item=returnvalue(); item.doit(); } when try run last line breaks build saying doit pure virtual function call. ideas? you returning reference local variable destroyed when call in returnvalue complete. instead try following: a &returnvalue(void) { return *(new b); } int main() { a& item = returnvalue(); item.doit(); } a better sol

ios - Localization broken for UISegmentedControl in Xcode 4.6 -

localization storyboard uisegmentedcontrol seems not working italian language. it's fine if localize programmatically, setting titles nslocalizedstrings. can confirm that? there openradar on this...