Posts

Showing posts from March, 2013

scheme - laziness in action? (Haskell) -

in chapter 6 of learn haskell , following function introduced: zipwith' :: (a -> b -> c) -> [a] -> [b] -> [c] zipwith' _ [] _ = [] zipwith' _ _ [] = [] zipwith' f (x:xs) (y:ys) = f x y : zipwith' f xs ys the author gives couple examples of use found easy enough follow. one: ghci> zipwith' (zipwith' (*)) [[1,2,3],[3,5,6],[2,3,4]] [[3,2,2],[3,4,5],[5,4,3]] which outputs [[3,4,6],[9,20,30],[10,12,12]] is example of lazy evaluation? tried translate zipwith' scheme (see below). got working "easy" examples, not last one, makes me think haskell's laziness might making difference. (define zipwith (lambda (f lista listb) (cond ((null? lista) (quote ())) ((null? listb) (quote ())) (else (cons (f (car lista) (car listb)) (zipwith f (cdr lista) (cdr listb))))))) no, although example evaluated lazily (like other function in haskell), behaviour doesn't depend on that. on finite lists ...

c# - log4net fallback appender configuration in case of missing config file? -

i've got c# (.net 3.5) application extensively use log4net. log4net configuration resides in app.config file. configuration done using [assembly: xmlconfigurator(watch = true)] in assemlyinfo.cs app uses single application-wide logger instance, instantiated in static constructor of logger wrapper class: public class logger{ //.... private static readonly ilog logger; static logger() { logger = logmanager.getlogger(assembly.getentryassembly().getname().name); appdomain.currentdomain.unhandledexception += onunhandledexception; } //.... } the app designed run on distant server, scheduler, no human presense, alone in dark. :) problem is, in case of missing config file silently crashes (no log4net config => no logging). are there way check if there appenders in config, , if not - programmatically add kind of fallback appender. i'm rather new log4x loggers family, so, if i'm asking trivial - please kind, log4net documen...

asp.net RegularExpressionValidator not working in mulitline textbox -

i using regularexpressionvalidator stop user using apostrophe (symbol '). working fine in single line textbox. shows error message when user uses enter key new line. validationexpression using is:validationexpression="^(?:(?!['].))*$" and code:   errormessage="you not allowed use apostorphene" controltovalidate="tbdrivinglicenseother" validationexpression="^(?:(?!['].))*$"> can not find solution anywhere on web. can help? it isn't clear me, trying prevent along apostrophs current regex... following expression: validationexpression="^[^']*$" prevents input of apostrophes in both textbox , multi-line textbox.

c# - Create a password encrypted and store it in sqlite to use in authentication -

i have winforms application, login form, , want store username , password encrypted in sqlite database. saw can use salt , hash, don't know how encrypt password in code, , compare when authenticate. any please? you need take username , password (the password masked text box, preferably second box confirmation) salt it, , create hash password, , insert plaintext username , salted hash of password in database. can verify users password in future comparing database stored version salted (same salt!) hash of user enters. note each user should have own salt randomly generate user when create account. (this more secure global salt value hacker discover). take @ this article . pretty covers bases, don't use sha-1 recommended in article. want slow hash function computationally expensive such bcrypt, or pbkdf2 (which included in .net). see "what makes hash function passwords" . (thanks @codeinchaos pointing out). you can use rfc2898derivebytes in system....

z3 - Efficiency of constraint strengthening in SMT solvers -

one way solve optimisation problems use smt solver ask whether (bad) solution exists, progressively add tighter cost constraints until proposition no longer satisfiable. approach discussed in, example, http://www.lsi.upc.edu/~oliveras/espai/papers/sat06.pdf , http://isi.uni-bremen.de/agra/doc/konf/08_isvlsi_optprob.pdf . is approach efficient , though? i.e. solver re-use information previous solutions when attempting solve additional constraints? the solver can reuse lemmas learned when trying solve previous queries. keep in mind in z3 whenever execute pop lemmas (created since corresponding push ) forgotten. so, accomplish must avoid push , pop commands , use "assumptions" if need retract assertions. in following question, describe how use "assumptions" in z3: soft/hard constraints in z3 regarding efficiency, approach not efficient 1 every problem domain. on other hand, can implemented on top of smt solvers. moreover, pseudo-boolean solvers ...

grails / log4j / conversion pattern / %throwable -

i use log4j 1.2.16 regarding "dependency-report". my conversion pattern '%d{yyyy-mm-dd hh:mm:ss,sss} %-5p %c: %m%n %throwable{short}' but %throwable not recognized, instead loglines contain '...hrowable{short}...' any idea ? i assume in appender? using enhancedpatternlayout (i believe need %throwable{n} ) console name: 'stdout', layout: new enhancedpatternlayout(conversionpattern: "%d{yyyy-mm-dd hh:mm:ss,sss} %-5p %c: %m%n %throwable{short}")

php - Parameter after url is not passed to called function when Parameter contains : or \ -

i passing keyword inputed user function search_result($input) in cakephp fron javascript www.example.com/search_result/input javascript input user gives error when input contains : no arguments found search_result . working fine other inputs. you want encode search term before passing php javascript (which assume means you're using ajax). you can using: encodeuricomponent : encodeuricomponent(term);

indexing - SQL Server - Query performs Index Scan instead of Seek -

i'm in process of indexing content of cms lucene, have extended sql server database schema add "isindexed" bit column, lucene indexer can find piece of content hasn't been indexed. i added index content table lookups isindexed column should go faster. database looks like: create table content ( documentid bigint, categoryid bigint, title nvarchar(255), authoruserid bigint, body nvarchar(max), isindexed bit ) create table users ( userid bigint, username nvarchar(20) ) the following indexes exist: content ( pk_content (clustered) : documentid asc ix_categoryid (non-unique, non-clustered) : categoryid asc ix_authoruserid (non-unique, non-clustered) : authoruserid asc ix_indexed_asc (non-unique, non-clustered) : isindexed asc, documentid asc ix_indexed_desc (non-unique, non-clustered) : isindexed desc, documentid asc ) users ( pk_users (clustered) : userid ) this query used find nonindexed content: ...

ada - GNATBENCH 2.6 Install on Eclipse -- Missing File . . . -

tried installing new academic version of gnatbench on eclipse (helios) today. seems find file missing. (i've notified adacore i'd expect it'll take week them reply.) here's wrote : cannot complete install because 1 or more required items not found. software being installed: gnatbench integration windriver workbench 2.6.0.20111210 (com.adacore.gnatbench.windriver.feature.group 2.6.0.20111210) missing requirement: gnatbench integration windriver workbench 2.6.0.20111210 (com.adacore.gnatbench.windriver.feature.group 2.6.0.20111210) requires 'com.windriver.ide.ui 3.1.0' not found anyone else similar issue ? you didn't follow installation instructions in readme.txt. please select eclipse plugin only, not windriver workbench plugin.

wordpress url rewrite $_ get variables with .htaccess -

ive seen few questions floating about, different needs im going outline here banging head against wall on one... i have permalinks set using wordpress's permalink structure %category%/%postname%/, , have build custom wordpress template files use _get variables in url myurl.com/region-home/?ssf_p_id=7 uses ssf_p_id variable stuff, , in case region-home page has id of 56 what trying achieve replace variable text myurl.com/region-home/kenboody what thinking of doing kind of re-write rule specific variable, there 9 or instances of variable this: if ?ssf_p_id=1 - url read /region-home/something if ?ssf_p_id=2 - url read /region-home/different if ?ssf_p_id=3 - url read /region-home/each-time and on i have tired adding rewriterule followed regular expression google searches have been making, problem have no idea how regular expressions work, im missing kind of slash in wrong place this far have gotten it: rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] re...

c# - Find .NET Recognizable Guids in a String -

i looking way find guid within string in .net recognizable pattern. there few regex's available in popular library , can't find 1 works of possible guids outlined here in msdn article . for example, lets have string this: activity: "{0xca761232, 0xed42, 0x11ce, {0xba, 0xcd, 0x00, 0xaa, 0x00, 0x57, 0xb2, 0x23}}", time:09:09:09:09 this should return: {0xca761232, 0xed42, 0x11ce, {0xba, 0xcd, 0x00, 0xaa, 0x00, 0x57, 0xb2, 0x23}} another example be: random string ca761232-ed42-11ce-bacd-00aa0057b223 random string this should return: ca761232-ed42-11ce-bacd-00aa0057b223 any ideas on how approach this? regular expressions way go here? solution is: using system; using system.text.regularexpressions; class program { static void main() { string input = "random string ca761232-ed42-11ce-bacd-00aa0057b223 random string"; match match = regex.match(input, @"((?:(?:\s*\{*\s*(?:0x[\da-f]+)\}*\,?)+)|...

javascript - Hiding all elements with the same class name? -

i'm trying hide elements same class name (float_form), i'm trying use script below show them (all of float_form class divs hidden). i've looked @ lot of jquery solutions, can't seem make of them work this. function show(a) { var e = document.getelementbyid(a); if (!e) return true; if (e.style.display == "none") { e.style.display = "block" } else { e.style.display = "none" } return true; } ​ edit: sorry if wasn't clear, not intend use jquery(and know not jquery). looking way use javascript recognize repeated classnames not in style= display:none; without compromising show/hide id element since there loop div id key. html div looks below, {item.id} being while loop. <div class="float_form" id="{item.id}" style="display: none;"> vanilla javascript function toggle(classname, displaystate){ var elements = document.getelementsbyc...

jsp - java.sql.SQLException: [Microsoft][ODBC Microsoft Access > Driver] Too few parameters. Expected 1 -

i'm calling inserstudent.jsp file in action of form addstudent.jsp want insert data in database. my database table's structure below: id|name|rollnumber|phonenumber|studyprogram|status below code inserstudent.jsp <%@page contenttype="text/html" pageencoding="utf-8"%> <%@ page import="java.sql.*" %> <!doctype html> <html> <body> <% string nam=request.getparameter("stuname"); string roll=request.getparameter("sturoll"); string phone=request.getparameter("stuphone"); string prog=request.getparameter("stuprogram"); string stats=request.getparameter("stustatus"); class.forname("sun.jdbc.odbc.jdbcodbcdriver"); string url = "jdbc:odbc:stdprojectdatadsn"; connection c = drivermanager.getconnection(url); statement statement = c.createstatement() ; string sql = "insert students (id, name, rollnumb...

compilation - Opa Executable Not Being Created -

when go compile opa, whether i've written, or simple 'hello, web!' script, see no executable produced. producing _build directory , javascript file. idea what's happening here? thanks in advance! the newest version of opa compiles javascript (running on node.js). produced javascript file need , should able run with: ./your_app.js

php - Call function to new window/tab then redirect to other function -

i making report fpdf. problem want call function using fpdf class in new window after processing save database, this: can figure 1. first have save database, data posted form form html. 2. call fpdf function print result same data first process. 3. redirect index function show data has been saved database. my code : //save database $this->my_model->insert($data); //call pdf function $this->print_the_result($data); //redirect redirect('my_class/index'); redirection codeigniter works within window operates with, server not know client (the browser). the (generally explained) workaround explained @ http://codeigniter.com/forums/viewthread/110435/#557038 : "you need send them page html output uses javascript open new window" with being said, might need view module redirection.

Run a JQuery script only on childs of one element -

is there easy way of running jquery script on 1 specific form , it's children without effecting other forms on website. at moment use child selector other selector, there command following selectors match within children of form? thanks you can use find : $('#myform').find('.otherclass').css({color: 'red'}) the selector .otherclass searched inside #myform . and small refactoring: var $f = function(selector) { return $('#myform').find(selector); } you can use: $f('.otherclass').css({color: 'red'}) to scoped version of jquery function.

java - How to handle windows file upload using Selenium WebDriver? -

Image
i have seen lots of questions , solutions on file upload using selenium webdriver on stackoverflow. none of working following scenario. someone has given solution following // assuming driver healthy webdriver instance webelement fileinput = driver.findelement(by.name("uploadfile")); fileinput.sendkeys("c:/path/to/file.jpg"); but still can't find window handle how can work on that?? i looking solution above scenario please check of following website http://www.uploadify.com/demos/ http://www.zamzar.com/ // assuming driver healthy webdriver instance webelement fileinput = driver.findelement(by.name("uploadfile")); fileinput.sendkeys("c:/path/to/file.jpg"); hey, that's mine somewhere :). in case of zamzar web, should work perfectly. don't click element. type path it. concrete, should absolutely ok: driver.findelement(by.id("inputfile")).sendkeys("c:/path/to/file.jpg"); in case...

opencv - Pixel height and width of blobs -

Image
i have image blobs. 1 pixel dot , not. when use cvblobslibs find height , width of 1 pixel dot, shows value equals zero. correct? tried use contours fill 1 dot pixel seems fail too. other approach can remove 1 dot pixel or remove height or width equal zero? i not sure why area of single pixel element zero. ( mind says should one). check out documentation contourarea . says, area calculated using green formula , area , number of pixels may different. secondly, remove noise, can use medianfilter. have shown below using python. input image : now code : >>> img2 = cv2.imread('d:\abid_rahman_k\work_space\mask.png',0) >>> contours,hierarchy = cv2.findcontours(img,cv2.retr_list,cv2.chain_approx_simple) number of non-zero pixels: >>> cv2.countnonzero(img2) 121 now apply medianfilter , check again number of non-zero pixels: >>> blur = cv2.medianblur(img2,5) >>> cv2.countnonzero(blur) 0 output image : edit...

asp.net - how to break file upload operation if file extension does not matching with my criteria? -

i have written 1 jquery code of upload files web handler. works fine want check if file's extension not matching criteria not allow upload file.. here code $(document).ready(function () { var button = $('#fuattachment'), interval; $.ajax_upload(button, { action: 'fileuploader.ashx', name: 'myfile', onsubmit: function (file, ext) { if (ext == "js") { alert(ext); } // this.disable(); }, oncomplete: function (file, response) { window.clearinterval(interval); $('<li></li>').appendto('.files').text(file); } }); }); i getting extension in ext variable. can check still if file contain extension want break upload operation. how can this?? please me if ...

c# - LINQ to SQL “Active Record” and “Unit Of Work” Pattern -

can please list references articles demonstrates following two, using linq sql? “active record” pattern “unit of work” pattern when search them, getting of examples clubbed asp.net mvc. don’t need mvc. looking code implementation (in linq sql) demonstrates these 2 patterns. i think you'll struggle find references such idea. to extent, linq sql implementing these patterns behind scenes. therefore, i'm not sure there's benefit gained layering additional behavior on top. do have more detail of you're trying achieve might facilitate more useful answer?

asp.net - Tabletool with datatable -

i using below code add export functionality in datatable. unable see export button, using master page. can give valuable remarks $(document).ready(function () { $('#tbloscarnominees').datatable({ "bjqueryui": true, "spaginationtype": "full_numbers", "aasorting": [[4, "desc"]], "sdom": '<"h"tfr>t<"f"ip>', "otabletools": { "abuttons": [ "copy", "csv", "xls", "pdf", { "sextends": "collection", "sbuttontext": "save", "abuttons": ["csv", "xls", "pdf"] } ] } below reference set in master page <link href...

css - How to overload a specific layer of CSS3 layered multiple background images -

possible duplicate: change 1 of multiple backgrounds on hover if had css declaration this: .selector { background: url(image.png), url(image2.png); } and on :hover wanted change first layer, e.g. .selector:hover { background: url(image3.png), url(image2.png); } is there way update image image3.png without having redeclare rest of stack? unfortunately, no, there isn't way that.

java - Unable to save the image properly from inputstream -

i getting exact bytes of image client , saving image file in driver. not displaying @ all. if (is != null) { file f = new file("e:/3432.jpg"); outputstream os = new fileoutputstream(f); byte[] b = new byte[1024]; int length; while ((length = is.read(b)) != -1) { os.write(b, 0, length); } is.close(); os.flush(); os.close(); } is there problem? this client side code android apache httpclient. multipartentity entity = new multipartentity(); entity.addpart("type", new stringbody("photo")); entity.addpart("data", new filebody(image)); httppost.setentity(entity); httpresponse response = httpclient.execute(httppost);

How to order the rows with respect to multiple columns in mysql -

how order rows respect multiple columns such ordering maintains condition if 2 people have same details same rank. give example illustrate :here firstly ordering done score , in case of tie penalty , still if tie exist both given same rank , next person gets adjusted rank. ################### rank roll score penalty 1 11 3 23 2 12 3 20 2 13 3 20 2 14 3 20 5 15 2 10 so question how fill rank column??if not possible in mysql other alternative?? test data: /* drop table test; create table test (roll int, score int, penalty int); insert test (roll, score, penalty) values (11, 3, 23), (12, 3, 20), (13, 3, 20), (14,3,20), (15, 2, 10); */ and here comes: alter table test add column `rank` int first; create temporary table tmp_test test; insert tmp_test (`rank`, roll, score, penalty) select cast(q.`rank` unsigned integer) `rank`, roll, score, penalty ( select if(@prev != concat(sq.score, '_', sq.penalty), @ro...

android - What target to set when Google Maps and Admob to be used Together -

i developing android application in need use google maps , admob together. facing errors way have specified target in manifest , project.properties file, allows me use either google maps or admob. the min sdk , target version specified in manifest file uses-sdk android:minsdkversion="8" android:targetsdkversion="13" in project.properties, specified "target=google inc.:google apis:8" on many blogs , questions on stack overflow, have seen people fixing admob issue specifying android target version 13 or higher. in case, if this, starts giving errors related mapactivity. please suggest target levels should specify in manifest file , project.properties can make both maps , admob work. many in advance.. i'm using in project minsdkversion="4" targetsdkversion="8" , i'm added android 3.0 google apis, had problems in past had check external library, can check too. library takes time in included , can have proble...

android - Fill RelativeLayout parent with LinearLayout child -

this seems simple i've exhausted google search patience. i have relativelayout has 2 sub linearlayout s side-by-side , want them both vertically fill parent, no matter height of 2 linearlayouts. being used listview row , content under @id/item_left shorter 1 on right. the background drawable doesn't fill entire row. any ideas on making both sides fill? <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="fill_parent"> <linearlayout android:id="@+id/item_left" android:layout_width="wrap_content" android:layout_height="fill_parent" android:paddingright="2dp" android:paddingleft="2dp" android:background="@drawable/item_left" android:orientation="vertical"> <textview android:id="@+id/time" ...

SolrNet/Solr - Large set of range queries causing 400 bad request -

running solr on tomcat 7 on win 2008 server. i looping through number of variables , creating set of range queries create query containing more 500 clauses. list<isolrquery> querylist = new list<isolrquery>(); //this var 1 , have 6 sets of vars this... (int n = 0; n < n; n++) { querylist.add(new solrquerybyrange<double>("var1_" + n, val1[n] * lowerbound, val1[n] * upperbound)); } //...var 2 (int n = 0; n < n; n++) { querylist.add(new solrquerybyrange<double>("var2_" + n, val2[n] * lowerbound, val2[n] * upperbound)); } //...var 3... , on... var results = solr.query(new solrmultiplecriteriaquery(querylist.toarray<isolrquery>(),"or"), new queryoptions { rows = 100, fields = new[] { "filename, id,score" }, facet = new facetparameters ...

c# - How to Convert plain text data into managed format? -

using c#, goal create working app accept text file input, read it, , separate sections of data within text file distinct groups contain index #, , name of section found in first part of section. this perhaps more of question how take data in plain text file, separate sections of data "groups"? , output file in managed format. the text input file has 13 fields, , additional field status, making 14 fields. the text input file have 1500 - 2000 groups of sections of data, there 2000 entries indexed , name of entry being first field, "package name". section of data this: package: horse version: 1.2.3 depends: libgcc provides: status: user installed other: other info other2: other info 2 package: cow version: 2.3.4 depends: libhay provides: milk status: user installed other: white black spots other2: has red cow bell around neck package: tractor version: 0.9.22 depends: diesel provides: etc... how can data read , placed appropriate ...

terminal - Theme Remover Script -

this script. permissions set 755. #!bin/bash echo "deleting themes don't want!" sleep 2 echo " d3@th deaths repo" ##### root test ##### # won't go farther unless you're uid=0 [ `id -u` != 0 ] && exec echo "oops, need root run script" echo ".....removing winterboard default themes!" echo "…..now deleting themes!" cd /library/themes/ rm -rf black navigation bars.theme dim icons.theme dim wallpaper.theme no docked icon labels.theme no undocked icon labels.theme solid status bar.theme transparent dock.theme user lock background.theme user wallpaper.theme white icon labels.theme sleep 2 echo ".....moving themes var" mv /library/themes /private/var/ && ln -s /private/var/winterboard /library/themes echo "finished deleting themes didn't want feel free delete me don't mind." sleep 3 apt-get remove net.death.themeremover killall winterboard exit 0 ever...

terminal - How do I create a static framed ASCII interface in Python? -

when use less command in mac terminal i'm shown 23 row slice of specified file. if move down file, scroll in terminal window, don't see file content before current slice. instead, see commands typed before using less . i use or similar effect create ascii game interface shows current screen, no history. draw frames on screen , change text or options within frames. common in older systems ran or entirely in command line environment. is there python module offers this? effect can or should implement myself? here example screen elements benefit effect. +-------------------------------------------------------------------+ | | | dialog dialog dialog dialog dialog dialog dialog dialog dialog | | dialog dialog dialog dialog dialog dialog dialog dialog dialog | | dialog dialog dialog dialog dialog dialog dialog dialog dialog | | dialog dialog dialog dialog dialog dialog dialog dialog dialog ...

localhost - Rails logging 127.0.0.1 every 5 minutes -

i have noticed in production rails log every 5 minutes, have request root url 127.0.0.1 apparently localhost. started "/" 127.0.0.1 @ 2012-07-01 14:05:03 -0500 processing applicationcontroller#landing */* rendered shared/_header.html.erb (0.9ms) rendered shared/_footer.html.erb (0.5ms) rendered application/landing.html.erb (5.7ms) completed 200 ok in 8ms (views: 7.9ms) i have never seen in other rails apps. using new relic, mongodb, nginx, , unicorn. can tell why happening or means? this monitoring application, since it's checking root path successful connection (i.e. http 200). have installed tools such monit? hosting provider using? may monitor without knowing.

c - gdb disassemble by line number -

say want disassemble lines m-n of file x, file x not in current context. operation possible, , if so, how? note: working on x86 linux. here's kludgy way it: set breakpoint on line you're interested in, , breakpoint acknowledgement gives address. clear breakpoint , run disas or x/20i on address.

oop - C++ Refactoring basic semantic into Objective classes -

i have simple program computes salaries 4 different worker types. it's written semantically want refactor can have each worker type it's own class. the main control of program in switch statement. i'd create class each worker type , use of appropriate setters , getters, perform right calculations. payroll.cpp #include <iostream> #include <iomanip> using namespace std; // function prototype void userprompt (void); int main () { // declare paycode , salary int paycode; double salary; // run user prompt function, input paycode userprompt (); cin >> paycode; while( paycode != -1 ) { //switch statement handle user input switch( paycode ) { case 1: // manager cout << "manager selected." << endl; cout << "enter weekly salary: "; // calculate manager's salary cin >> salary; cout << "manager's pay $" <...

python - Installing lxml in virtualenv for windows -

i've started using virtualenv, , install lxml in isolated environment. normally use windows binary installer, want use lxml in virtualenv (not globally). pip install not work lxml, i'm @ loss can do. i've read creating symlinks may work, although unfamiliar how symlinks work , files should creating them for. else know of methods install lxml in virtualenv on windows? if creating symlinks method works i'm willing learn if can point me in right direction. the easiest way copy library virtualenv site-packages folder. symlinking method of making appear on filesystem file there physically in location. isolated if copied library over. so go global site-packages folder , copy on both lxml folder , lxml egg folder virtualenv site-packages. if wanted symlink (for ntfs), here .

jsf - Different Context menu on each node of tree -

in jsf project want display different context menu on every node of tree based on conditions (to precise permissions) present according xhtml, have binded context menu tree getting same menu on every node of tree. here code: <p:contextmenu for="treeid"> <p:menuitem value="create" update=":centerpanel" actionlistener="#{somebean.createprivilege}" onstart="statusdialog.show();" oncomplete="statusdialog.hide();" /> <p:menuitem value="edit" update=":commondialog :centerpanel" actionlistener="#{somebean.editprivilege}" onstart="statusdialog.show();" oncomplete="statusdialog.hide();" /> <p:menuitem value="delete" onstart="delprivilegeconfirmdialog.show();" /> </p:contextmenu> <p:scrollpanel mode="native" styleclass="scroll-panel"> <p:tree id="treeid" value=...

asp.net - Open gridview inside template field of gridview -

i have image button in template field of gridview. want open gridview below row of plus button clicked problem inner gridview opens column of parent grid view , not opening below selected row. tried various design methods still not working. using jquery open child gridview on image button click. below design of grid , code jquery. <div class="gridcontentholder"> <asp:gridview id="grdsamplestock" runat="server" alternatingrowstyle-cssclass="alt" autogeneratecolumns="false" cssclass="stylegrid" gridlines="none" onselectedindexchanged="grdsamplestock_selectedindexchanged" onrowdatabound="grdsamplestock_rowdatabound" onrowcreated="grdsamplestock_rowcreated"> <alternatingrowstyle cssclass="alt" /> <columns> <asp:templatefield> <itemtemplate> ...

Returning Django comments for a Tastypie resource -

my django site has photo model represents photos in system , i'm using django.contrib.comments allow users comment on these. working fine i'd extend tastypie api allow accessing of comments photoresource using url /api/v1/photo/1/comments 1 id of photo. i'm able url work fine no matter sort of filtering i'm doing seem return complete set of comments rather set supplied photo. i've included cut down selection of current code api below: class commentresource(modelresource): user = fields.foreignkey(userresource, 'user') class meta: queryset = comment.objects.all() filtering = { 'user': all_with_relations, } class photoresource(modelresource): user = fields.foreignkey(userresource, 'user') class meta: queryset = photo.objects.all() filtering = { 'id': 'exact', 'user': all_with_relations } def ...

visual c++ - how to set labels in inline assembly? -

how in c++ visual can set labels when need use inline assembly, example... __asm { push eax push var1 mov ecx,dword ptr ds:[var2] call dword ptr ds:[var3] jmp var4 } where var varables link value or address? i have tried following dword var2 = 0x991770; //0x991770 location of function __asm { ..code mov ecx,dword ptr ds:[var2] ..code } but app crashes, how done? use offset variablename access variables inline assembly. see reference here . example: char format[] = "%s %s\n"; char hello[] = "hello"; char world[] = "world"; int main( void ) { __asm { mov eax, offset world push eax mov eax, offset hello push eax mov eax, offset format push eax call printf //clean stack main can exit cleanly //use unused register ebx cleanup pop ebx pop ebx pop ebx } }

php - Storing image URL's in database and retrieval process -

i new php/mysql. trying store image in database via url(image location) @ moment php code storing image in folder in directory called upload. insecure want put url in database. code based of imageupload-website here url example generated code: http://www.example.com/imageupload/uploads/medium/uniqueimagename.jpg how construct valid table store url's? should varchar? how can retrieve url database , display image? php query of filename in database or original url? 1. how construct valid table store url's? should varchar? i wouldn't store complete path of url database. so, if have: http://www.example.com/imageupload/uploads/medium/uniqueimagename.jpg i store: size: 2 (medium) name: uniqueimagename ext: jpg 2. how can retrieve url database , display image? php query of filename in database or original url? just fetch data database , put raw data in html

Sending an email via localhost in PHP -

i'm trying send email through php. gives following warning. warning: mail() [function.mail]: failed connect mailserver @ "smtp.ntlworld.com" port 25, verify "smtp" , "smtp_port" setting in php.ini or use ini_set() in c:\wamp\www\wagafashion\customerside\bulkinquiry.php on line 1007 in php.ini, smtp has been changed follows. [mail function] ; win32 only. smtp = smtp.ntlworld.com smtp_port = 25 ; win32 only. sendmail_from = tiny1999@gmail.com after configuring php.ini, wamp restarted , gave above warning. other settings made send email via localhost in php? use phpmailer instead: https://github.com/phpmailer/phpmailer how use it: require('./phpmailer/class.phpmailer.php'); $mail=new phpmailer(); $mail->charset = 'utf-8'; $body = 'this message'; $mail->issmtp(); $mail->host = 'smtp.gmail.com'; $mail->smtpsecure = 'tls'; $mail->port = 587; $mail->smtpdebu...

c# - How do I merge all the cases into One? -

private void makemolevisable(int mole, picturebox molehill) { switch (mole) { case 1: if (p01.image == pmiss.image && molehill.image == phill.image) { molesmissed ++; } p01.image = molehill.image; break; case 2: if (p02.image == pmiss.image && molehill.image == phill.image) { molesmissed++; } p02.image = molehill.image; break; ** have 36 of these case statements each 1 different picture box; how group them 1 case statement code can more efficient** try this: string controlidsuffix = mole < 10 ? "0" : "" + mole.tostring(); control[] picboxes = this.controls.find("p" + controlidsuffix, true); if (picboxes.length > 0) { picturebox p = picboxes[0] ...

javascript - Backbone Fetch Request is OPTIONS method -

i have backbone collection object following url "http://localhost:8080/api/menu/1/featured". trying perform fetch operation retrieve collection url , parse it. however, on server side, method type see request options. server suppose support method. not sure how backbone figuring out method type use, , why changes options method type randomly sometimes. using node.js server process request. code below pretty did. var featuredcollection = backbone.collection.extend({ model:featuredcontent, url:function () { return url_featured; }, parse:function (response) { console.log(response); return response; } }); var featuredcollection = new featuredcollection(); featuredcollection.fetch(); please help, thanks! it's been awhile, remember coming across before. there's 2 things be: backbone default tried restful api calls backend, means get, post, put, , delete. many backends weren't built real rest support , support , post. w...

jquery - changing on click to on page load -

i found jquery script delaying , fading in list items on pressing/clicking button (works great); how change run on page load rather on click please? <script> function fadeitem() { $('#thisimage ul li:hidden:first').delay(25).fadein(fadeitem); } $('button').click(fadeitem); $('#thisimage li').hide(); </script> my list items within #thisimage div remove $('button').click(fadeitem) , add : $(document).ready(function(){ fadeitem(); })

cocoa - NSString pointer passed to function... not keeping the value I set -

i'm not sure i'm doing wrong here. i've tried setting s1..3 in foo using: s1 = [[nsstring alloc] initwithstring:[filepaths objectatindex:0]]; context below: void foo(nsstring *s1, nsstring *s2, nsstring *s3){ //assign long string nsstring *fps //... //break fps smaller bits nsarray *filepaths = [fps componentsseparatedbystring:@"\n"]; //the above worked! let's assign them pointers s1 = [filepaths objectatindex:0]; //repeat s2 , s3 nslog(@"%@",s1); //it worked! we're done in function } int main(int argc, const char * argv[]){ nsstring *s1 = nil; //s2 , s3 foo(s1,s2,s3); //this should work nslog(@"%@",s1); //uh oh, null! return 0; } no. you passing in pointers objects can mutated locally. not changing original objects, might think plain c. if want use method (which not recommend - it's odd see in cocoa except in case of nserror ), have like: void foo(nsstr...

php - Issues with Doctrine 2 Mappings Yaml -

i trying these mappings right cannot seem , love advice... entities\user: type: entity onetomany: citations: targetentity: citation mappedby: user cascade: ["all"] entities\citation: type: entity manytoone: item: targetentity: item inversedby: citations joincolumn: name: item_id referencedcolumnname: id manytoone: user: targetentity: user inversedby: citations joincolumn: name: user_id referencedcolumnname: id entities\item: type: entity onetomany: authors: targetentity: author mappedby: item cascade: ["all"] onetomany: citations: targetentity: citation mappedby: item entities\author: type: entity manytoone: item: targetentity: item inversedby: authors the errors schema validator tool are: [mapping] fail - entity-class 'entities\item' mapping invalid: * association ent...

Rails not finding controller action -

so, have following link-to: <%= link_to(outing_add_guests_path, :class => 'modal') %> <div id="notimportant"></div> <% end %> when click on it, rails tells me that no route matches {:controller=>"outings", :action=>"add_guests"} however, here's routes file: resources :outings "/add_guests" => "outings#add_guests" post "/add_guests" => "outings#add_guests" delete "/remove_guests" => "outings#remove_guests" end and corresponding action outings controller: def add_guests @outing_guest = outingguest.new(:outing_id => params[:outing_id]) @outing_guest.user_id = params[:user_id] if @outing_guest.save flash[:notice] = "guest added successfully" redirect_to({ :action => 'outing', :id => params[:outing_id] }) else flash[:notice] = "guest not added" ...

php - When to use single quotes, double quotes, and backticks in MySQL -

i trying learn best way write queries. understand importance of being consistent. until now, have randomly used single quotes, double quotes, , backticks without real thought. example: $query = 'insert table (id, col1, col2) values (null, val1, val2)'; also, in above example, consider "table," "col[n]," , "val[n]" may variables. what standard this? do? i've been reading answers similar questions on here 20 minutes, seems there no definitive answer question. backticks used table , column identifiers, necessary when identifier mysql reserved keyword , or when identifier contains whitespace characters or characters beyond limited set (see below) recommended avoid using reserved keywords column or table identifiers when possible, avoiding quoting issue. single quotes should used string values in values() list. double quotes supported mysql string values well, single quotes more accepted other rdbms, habit use single quot...

I am using dispatch for scala, how can I convert the response of the web service into sa JSON file? -

i making http request web service using dispatch library , scala. working fine, wanted convert response json. can response it's in string format. here's i'm doing: val http = new http val handler = http(req.as_str) req request variable containing url. thanks help. :d if request case class, can use lift-json serialise case class tree json string (and back). other such (de)serialisers exists, exampe, sjson , i've worked lift-json far.

javascript - Delete object/associative array -

lets have created object , properties in javascript follows- var obj = {}; obj['bar'] = 123; obj['bar']['foo'] = new array(); obj['bar']['xyz'] = new array(); after this, push elements 2 arrays. if write delete obj['bar']; will 2 arrays deleted ? will 2 arrays deleted ? they'll eligible garbage collection , assuming nothing else has references them. , nothing will, based on code. when , whether they're actually cleaned up implementation. but note they're eligible gc before remove bar , because code doing quite odd. see comments: // creates blank object, far good. var obj = {}; // sets `bar` property number 123. obj['bar'] = 123; // retrieves value of `bar` (the primitive number 123) , // *converts* `number` instance (object), // creates property on object called `foo`, assigning // blank array it. because number object never stored // anywhere, both , array eligible // g...

forms - Validating name field using jquery -

actually new jquery web designing now need piece of code invoke after blur event on text box. i need jquery code validating name field in html form. make sure add latest version of jquery.... here sample validating not null. $(document).ready(function() { $('input#fname').on('blur', function() { if( $(this).val() == '' || $(this).val() == "null" { // code handle error } else { return true; } }) });

Can a LESS CSS pseudo-class pass an attribute of the selector to a function? -

i'm trying create single point of definition gradients in less css. i've created function writes cross-browser css code me, there's 1 issue can't solve. i specify gradients once , have seperate function (that listens argument "flip") swap 2 color variables on hover. i've posted example below: selector { .background-gradient(rgba(27, 117, 185, .35), 48%, rgba(22, 97, 154, .35), 52%); } selector:hover { .background-gradient(flip); } i've been looking solution but, of course, found nothing. sum things up: i'd have function reads selector's gradient values , uses them create hover style swapping colors. hope it's possible. thanks in advance! ps: creating function listens "flip" (pattern-matching) not problem, thought give better idea of i'm trying achieve. its not 100% clear want, why not have this .selector { @startcol: rgba(27, 117, 185, .35); @startpercentage: 48%; @endcol: rgba(22, 97, 15...

javascript - Emberjs pass parameter from template to function -

i have simple foreach loop: {{#each app.userc.companies}} <button class="btn btn-inverse btn-huge" {{action setcompany target="app.userc"}}>{{this.name}}</button> {{/each}} "companies" element have 2 elements: name , id when click on button want know "this.id" clicked? how achieve this? tried: setcompany: function(e){ console.log($(e.target).data(...)); //output: <script id='metamorph-4-start' type='text/x-placeholder'></script>4ff2f79461d69a9811000001<script id='metamorph-4-end' type='text/x-placeholder'></script> } but pretty useless , bet not way things done in ember the jquery click event given context handlebars when triggered. default current view context, can pass in whatever like. {{#each app.userc.companies}} <button class="btn btn-inverse btn-huge" {{action setcompany target="app.userc" context="this"}}...