Posts

Showing posts from March, 2015

SQL rows dissapear when join added -

select tblartworktemplates.id, tblartworktemplates.datecreated, tblspecifications.txtpagination, tblspecifications.flatsizew width, tblspecifications.flatsizel length, tblspecifications.flatsizeuom uom, (select count(1) expr1 tblartworkuploads (templateid = tblartworktemplates.id)) uploadcount, (select count(1) talks tblartworktemplatemessages (templateid = tblartworktemplates.id)) talkcount, tblartworktemplates.lasteditping, tblusers.username expr1 tblusers inner join tblartworktemplates inner join tblspecifications on tblartworktemplates.specid = tblspecifications.id on tblusers.id = tblartworktemplates.editpinguserid (tblartworktemplates.userid = 70) the tblusers join causing rows disapear when tbla

How to return specific list result from linq to entities -

hi experts currenly write code: public ilist<tresult> getcustomquery<tresult>(int orderid, func<order, tresult> selector) { using(repositorydatacontext = new northwindentities()) { ilist<tresult> res = (from od in repositorydatacontext.order_details join o in repositorydatacontext.orders on od.orderid equals o.orderid join p in repositorydatacontext.products on od.productid equals p.productid join c in repositorydatacontext.customers on o.customerid equals c.customerid o.orderid > orderid select new { o.orderid, od.unitprice,

applying a filter on a string in python -

i have user typing in username , want valid strings pass through, meaning characters in [a-za-z0-9]. pretty new python , unsure of syntax. here's example of want in code, check through username , return false upon illegal character.: def _checkinput(input): char in input: if !(char in [a-za-z0-9]): return false return true thanks! you need isalnum : >>> name = raw_input('enter name: ') enter name: foo_bar >>> name.isalnum() false >>> name = raw_input('enter name: ') enter name: foobar >>> name.isalnum() true

javascript - parent-child window in java script -

i want stop program flow until receive input child window. code parent window: <html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1252"> <title>mainpage</title> <script language="javascript"> function openpage(){ window.open("ok.htm","warning",'fullscreen=0,height=150,width=300,left=500,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,top=200'); //this place want program wait till input change in document.fm.w.value form child window/////// alert(document.fm.w.value);/// alert should contain new value acorrding selection of button in child window//// } </script> </head> <body> <form name="fm"> <input type="hidden" size="40" id="w" value="wwww"> <input type="button" value= "press" id="q" name= "q" oncli

asp.net - Selective JSON Serialization using ASMX Web Service -

i have webservice use json formatted custom classes, example: public class custom { private int _myprivateproperty; public int tobeaccessedonlyincode { { return _myprivateproperty; } set { _myprivateproperty = value; } } public int tobeserialized { { return _myprivateproperty * 1000; } } } the above example illustration purposes. the problem don't want return original object format in json response, need original format in code. i have tried [datacontract]/[datamemeber] attributes in class, leaving out tobeonlyaccessedincode property, have tried using [nonserialized] attribute above private object container. no avail. is there way in can prevent field being serialized json when using built in asmx scriptserializer? i've spent few hours lookin

symfony1 - Backup MySQL via php, in a Symfony application -

i'm trying php script backup database. here's i've tried far : $command = "mysqldump -u [username] -p [password] [databasename] | gzip > db.sql.gz"; $this->output = system($command); how password , username databases.yml ? how can script sends me backup file, instead of saving on server (à la phpmyadmin) ? you can create symfony task. if pass in environment (i.e. dev, prod) or connection access doctrine connection manager , create connection. can use connection make database dump or connection details connection manager. you can use doctrine insert sql task template task. i've done similar in past.

.net - How can I add rows to a DataGridView control in C#? -

i have created 3 columns on datagridview control, don't know how add rows. please help. possibly duplicate of: how add data datagridview or how add row datagridview or how add rows , columns datagrid? or how can add 1 row datagridview? please use search bar located on top right corner of site if think question may have been covered.

c++ - qt preprocessor -

what order of compiling in qt? understood impossible write #define begin_signals signals: is way make conditional compilation using #ifdef qt signals: #endif just tested , #define begin_signals signals: does work expected since moc preprocessing well. order of compilation qobject class myqobject - start moc myqobject.h moc run c preprocessor moc produces moc_myobject.cpp file moc_myobject.cpp compiled native compiler myqobject.cpp compiled native compiler before or after this. be mindful word signals macro translates protected when native compiler used. i'm not sure why ever want define begin_signals

iphone - Creating an object, strange question -

i have class "projectiles", , want create object it. minimise code, want specify object string, clean thins alot. example: have string, tempenemy.atktype = @"homing_fireball"; now want create object same name projectiles class: projectiles *tempenemy.atktype; is possible? final result object projectiles class called homing_fireball..? thanks!! i doubt possible. i'm not expert inner core of objective-c. i suggest store projectile in nsmutabledictionary. store object key of @"homing_fireball". , can reference projectile *someprojectile = [myprojectiles objectforkey:tempenemy.atktype];

PHP: html table layout with data coming from query -

i'm trying fix layout of data coming database in way: the query returning names of games , points awarded each game. the layout need that: in 1 row name of game , in row below points, 2 columns , carriage break until results displayed. please see image, it'll show light: http://217.116.9.130/wordpress/htmltablefromquery.gif what have done far following code, cannot display layout needed. ![<?php echo "<table border=1><tr>"; $count=0; $sql2 = "select * games"; $res2= $db_class->select($sql2); if (mysql_num_rows($res2)>0) { while($row2 = $db_class->get_row($res2)){ $gname = $row2['gamename']; $gpoints = $row2['gamepoints']; $count++; echo"<td>".$gname."</td>"; if($count % 2

Iterating over a JSON array in scala -

i'm using json lib net.sf.json( http://json-lib.sourceforge.net/apidocs/net/sf/json/package-summary.html ) in scala code. also, i'm using specs bdd framework ( http://code.google.com/p/specs/ ) unit testing. in dobefore block, have following code: dobefore { iter = serversjson.iterator() } serversjson jsonarray object. outside dobefore block, have declared variables used follows var serversjson:jsonarray = null var iter:iterator[jsonarray] = null but on compilation i'm getting following error. error: type mismatch; found : java.util.iterator[?0] type ?0 required: java.util.iterator[net.sf.json.jsonarray] iter = serversjson.iterator() i guess way have declared iter object outside dobefore incorrect. how fix this? please thank you. as indicated here , json library's iterator method returns raw iterator , not iterator[jsonarray] . you'll want declare follows: var serversjson:jsonarray = null var iter:iterator[_] = null

s60 - Reading RMS Data of other Midlet -

i want read rms data created 1 midlet second midlet target devise s60 possible?? it possible. open record store associated named midlet suite. midlet suite identified midlet vendor , midlet name. access granted if authorization mode of recordstore allows access current midlet suite. access limited authorization mode set when record store created: authmode_private - succeeds if vendorname , suitename identify current midlet suite; case behaves identically openrecordstore(recordstorename, createifnecessary). authmode_any - succeeds. note makes recordstore accessible other midlet on device. have privacy , security issues depending on data being shared. please use carefully. untrusted midlet suites allowed share data not recommended. authenticity of origin of untrusted midlet suites cannot verified shared data may used unscrupulously. see links reference. sharing data between midlet suites advanced programming

startup - Application Start Before Windows Explorer -

some installation applications stop (or appear stop) normal windows booting. computer starts, user logs in , installation program starts before others (like windows explorer). how can replicate behaviour in own program? e.g. os boot login the program runs, updates etc. the rest of programs run (e.g. windows explorer , ever runs on startup) if want start application before shell starts, can add value userinit value in registry. in key: hkey_local_machine\software\microsoft\windows nt\currentversion\winlogon there value named userinit . change program run before userinit.exe. example, start notepad before shell/everything else initialized: c:\windows\system32\notepad.exe,c:\windows\system32\userinit.exe use commas separate programs should started. this works windows xp, vista, , 7.

c# - Control/variable naming conventions in ASP.NET -

i think main distinction in naming between logic , view-related objects. might have variable named “ username ” in code behind file of page, .net textbox in user supposed enter username (a sensible id “ username ”). how can differentiate (id-wise), between logic “ username ” , view “ username ”. question is, sensible distinction make when coming these names? in opinion, variable name/control id should never describe is, does. “ tbusername ” describes textbox, “ strusername ” defines string. one idea prefix view related objects “ vwusername ” , keep logic part “ username ”. make sense? when have situation have validators? name them “ vwusernamerequiredvalidator ”, or “ vwemailaddressformatvalidator ”? in situation need describe is? give .net requiredfieldvalidator object id of “ rfvusername ”? i want idea of other people think on this, because want come sensible , consistent naming convention system going forward. i’m interesting hear arguments type of system. hunga

scheme - let me know the error in the code and edit it -

define function called symcount takes symbol , list , returns number of times symbol occurs in list. if list contains sublists, occurrences should counted no matter how nested. (define syscount(lambda (n x) (if (empty? x) 0 (if (equal? n (car x)) (+ 1 syscount(n (cdr x))))))) this have written me pls (define (syscount n x) (if (null? x) 0 (if (list? (car x)) (+ (syscount n (car x)) (syscount n (cdr x))) (+ (syscount n (cdr x)) (if (equal? n (car x)) 1 0))))) output is (syscount '1 '(1 2 3)) 1 (syscount '1 '(1 (1 2) 3)) 2 (syscount '1 '(1 (1 2) 1 (1) 3)) 4

Can't get neural network result in MATLAB -

i guess question simple, anyway... i've created neural network using net = newff(entry_borders, [20, 10], {'logsig', 'logsig'}, 'traingdx'); where entry_borders array 50x2: [(0,1), (0,1), ...] it must network hidden layer 50 entries , 10 outputs, isn't it? but when run this: test_result = sim(net, zeros(50)); disp(test_result); i matrix 10x50 elements in test_result (instead of 10 scalar values) - what's that?? i'm not speaking teaching process that's why here's sily code... zeros(50) gives 50x50 matrix, treated 50 examples (each of dimension 50), gives 50 predictions (each of size 10)

c# - Remove text after a string occurrence -

i have string has following format: string sample = "a, abc, 1, acs,," as can see, there 5 occurences of , character. need remove everything after 4th occurrence final result be: string result = fx(sample, 4); "a, abc, 1, acs" is possible without foreach ? in advance. you this: sample.split(',').take(4).aggregate((s1, s2) => s1 + "," + s2).substring(1); this split string @ comma , take first 4 parts ( "a" , " abc" , " 1" , " acs" ), concat them 1 string aggregate (result: ",a, abc, 1, acs" ) , return except first character. result: "a, abc, 1, acs" .

windows - Display of Asian characters (with Unicode): Difference in character spacing when presented in a RichEdit control compared with using ExtTextOut -

Image
this picture illustrates predicament: all of characters appear same size, space between them different when presented in richedit control compared when use exttextout. i present characters same in richedit control (ideally), in order preserve wrap positions. can tell me: a) which more correct representation? b) why richedit control displays text no gaps between asian characters? c) is there way make exttextout reproduce behaviour of richedit control when drawing these characters? d) would different if working on asian version of windows? perhaps i'm being optimistic, if has hints offer, i'd interested hear. in case helps: here's text: 快的棕色狐狸跳在懶惰狗1 2 3 4 5 6 7 8 9 0 apologies asian readers, merely testing our unicode implemetation , don't know language characters taken from, let alone whether mean anything in order view effect pasting these characters richedit control (eg. wordpad), may find have swipe them , set font 'arial'. th

java - Divide Spring configuration across multiple projects -

we have quite few projects use same codebase (backend code). frontend tends different. decided best approach seperate backend , frontend different projects: engine , project_name now these spring-projects. seem logical if divide spring configurations aswell: database.xml , services.xml belong project engine . , specific frontend.xml belong project_name . link these up, need generic springbeans.xml imports of these xml's. i tried following directory structure: engine project config spring database.xml services.xml project_name project config springbeans.xml spring frontend.xml the contents of springbeans.xml simply: <import resource="spring/database.xml"/> <import resource="spring/services.xml"/> <import resource="spring/frontend.xml"/> i set eclipse project_name project references engine project. when start it, springbeans.xml gets found, xml files in engine project aren't fou

bankers algorithm - How do I determine whether a deadlock will occur in this system? -

n processes share m resource units can reserved , release 1 @ time. maximum need of each process not exceed m, , sum of maximum needs less m+n. can deadlock occur in system ? the system describing looks semaphores about last question : yes. "could" deadlock ; if don't see how, ask young/shameful/motivated/deviant developer. one way make 1 ; have strange locking/releasing resources rules. example, if process needs m resources perform task, locks half of them right away, , waits other half available before doing anything. i assume never gives until have m precious resources , releases them once task done. a single process wouldn't cause problems several lock more m total resources , need more of them out frozen state.

clr - what is the difference between building static and dynamic language for .net? -

i student , want build own .net language general purpose, see how done, , learn new. you think better choice? build static language targets clr or build dynamic language on top of dlr? what steps in process of building these 2 kinds of languages different? what available tools generating scanner, parser , cil code? found people recommend antlr parser generator generating ast, , translating dlr expression tree, doesn't need generate cil code. i recommend antlr, , book it. unless know grammar generation, you'll need reference material. i recommend using antlr ast generate codedom. use dlr or not, depending on kind of language want make. i've had great success both routes though. i've generated cil, wasn't awesome did work. leave last resort.

hash - Simplest HTML anchor issue -

i stumped on html.. can't believe it. so, have submenu powered javascript. <a href="#" class="subpage"><span>subpage</span></a> i have deleted js , still happens misunderstand something. when load page bit slow , have time hit sub menu button. if keep tapping while page loading, instead of putting hash on end of url , not changing page taking me /dir/# resetting page. any idea why? maybe page still in browsers cache. @ source make sure js not there, or press ctrl+f5.

design - what is LDC metrics and fullform of LDC -

i tried googling.my friend has give seminar on dgml(design markup language) , unable figure ldc has come across on studying dgml paper i deduced, same paper friend reads probably, ldc stands local declarations count.

sql - Random select preventing some duplicates -

from table name groupid null b 1 c 1 d 2 e null f null g 3 result expected random top 4 selection name gruopid null b 1 e null g 3 resuming want random names 1 kind of groupid if groupid <> null select newid() type returns "select top(4) * table order newid()" name gruopid null b 1 e null c 1 i don´t want that. hope made self clear! in advance you can try (on sql server 2005+). ;with cte ( select *, row_number() over(partition groupid order newid()) corr yourtable ) select top 4 name, groupid cte groupid null or corr = 1 order newid()

vb.net - Print report directly to the printer -

how can print report directly printer, instead of viewing on screen? thanks / furqan you may need use web service call report, receive byte stream , print directly. http://msdn.microsoft.com/en-us/library/ms152787.aspx

compression - How to print the content of a tar.gz file with Java? -

i have implement application permits printing content of files within tar.gz file. for example: if have 3 files in folder called testx: a.txt contains words "god save queen" b.txt contains words "ubi maior, minor cessat" c.txt.gz file compressed gzip contain file c.txt words "hello america!!" so compress testx, obtain compressed tar file: testx.tar.gz. so java application print in console: "god save queen" "ubi maior, minor cessat" "hello america!!" i have implemented zip version , works well, keeping tar library apache ant http://commons.apache.org/compress/ , noticed not easy zip java utils. could me? i have started looking on net understand how accomplish aim, have following code: gzipinputstream gzipinputstream=null; gzipinputstream = new gzipinputstream( new fileinputstream(filename)); tarinputstream = new tarinputstream(gzipinputstream); tarentry entryx = null; while((entryx = is.getnextentry

selection - Zend Framework: select element - how to set required? -

how set status "required" zend_form_element_select when has value "0"? $country = new zend_form_element_select('wbm_country'); $country->setlabel('select:') ->setrequired(true) ->addmultioptions(array(0 => ' ----------- ') + $this->_countries_select); when wbm_country 0 doesn't show error @ all.:( if want 0 give error can use $required = new zend_validate_notempty (); $required->settype ($required->gettype() | zend_validate_notempty::integer | zend_validate_notempty::zero); $country = new zend_form_element_select('wbm_country'); $country->setlabel('select:') ->addvalidators (array ($required)) ->addmultioptions(array(0 => ' ----------- ') + $this->_countries_select);

complexity theory - Asymptotic runtime for an algorithm -

i've decided try , problem analyzing worst possible runtime of algorithm , gain practice. since i'm beginner need in expressing answer in right way. came accros problem in book uses following algorithm: input: set of n points (x1, y1), . . . , (xn, yn) n ≥ 2. output: squared distance of closest pair of points. closepoints 1. if n = 2 return (x1 − x2)^2 + (y1 − y2)^2 2. else 3. d ← 0 4. ← 1 n − 1 5. j ← + 1 n 6. t ← (xi − xj)^2 + (yi − yj)^2 7. if t < d 8. d ← t 9. return d my question how can offer proof t(n) = o(n^2),t(n) = Ω(n^2) , t (n) = Θ(n^2)?,where t(n) represents worst possible runtime. know f o(g), if , if there n0 ∈ n , c > 0 in r such n ≥ n0 have f(n) ≤ cg(n). , f Ω(g) if there n0 ∈ n , c > 0 in r such n ≥ n0 have f(n) ≥ cg(n). now know algoritm doing c * n(n - 1) iterations, yielding t(n)=c*n^2 - c*n. first 3 lines executed o(1) times line 4 loops n - 1 iterations o(n) . line 5 loops n - iterations o(n) .does each line of

Why is there an implicit type cast from DateTime to DateTimeOffset in Silverlight? -

why there implicit type cast datetime datetimeoffset in silverlight? could provide specific example of this? without more info, assume it's can use standard operators generate datetimeoffset object performing arithmetic on datetime objects. without more specific example toward question, it's hard tell.

Using Html.EditorFor() for custom type in ASP.NET MVC -

i have custom type money viewmodel: public class money { public money(decimal value) { value = value; } public decimal value { get; private set; } public override string tostring() { return string.format("{0:0.00}", value); } } and want render textbox in asp.net mvc via html.editorfor(viewmodel => viewmodel.mymoneyproperty) doesn't work. there special interface have implement in money? best regards , in advance, steffen try this: public class money { public money(decimal value) { value = value; } [displayformat(dataformatstring = "{0:0.00}", applyformatineditmode = true)] public decimal value { get; private set; } } and in view: <%= html.editorfor(x => x.somepropertyoftypemoney.value) %> or have custom editor template money ( ~/views/shared/editortemplates/money.ascx ): <%@ control language="c#" inherits="system.web.m

SSIS: Using rows from Flat file source and pass them as parameter values to stored procedure -

Image
i have followed steps mentioned in below post no success. ssis execute stored procedure parameters .csv file sql server 2005 i cant seem map flat file output columns stored procedure parameters, done? thanks dave it under column mappings on oledb command task.

django - Automatically posting to facebook page with python -

i want make script lets me post facebook fan page (which i'm admin of) as far i've seen, graph api examples making facebook apps in python , make them communicate python, quite different want. also graph api requires oauth token, documentation claims it's obtained doing: https://www.facebook.com/dialog/oauth ? client_id=your_app_id&redirect_uri=your_url i think implies: a) have create facebook app this, didn't think necessary (after it's require standard credentials , wouldn't used other people), fine. have app created task. b) need url, don't have, because it's script. any ideas on should info? first need facebook_app_id , facebook_app_secret, facebook when register app. then include needed urls. redirect_client_url = 'http://your-redirect-url' access_token_url = 'https://graph.facebook.com/oauth/access_token?client_id='+consumer_key+'&redirect_uri='+red irect_client_url+'&cli

debugging - CSS HasLayout IE7 Bug -

first off, i've read following articles, brush on issues , i've dealt them before: position relative / absolute / fixed in ie http://www.brunildo.org/test/ie_raf3.html http://www.satzansatz.de/cssd/onhavinglayout.html for people these problems might new , above help, in case, have following in non-ie browsers: http://cl.ly/4n6f [image] and following in ie7 http://cl.ly/4nym [image] i understand need trigger haslayout = true on large brown <div id="footer"> because position: relative triggering haslayout = false in ie7. i've tried zoom: 1 , , display: inline-block in attempt trigger haslayout on #footer no success. here site live viewing pleasure: http://hannahnour.co the cause of disappearing div haslayout false on #footer . how can trigger it?! @sweetroll correct, has nothing haslayout . the problem inside /wp/wp-content/themes/custom_bellydance_theme/style.css . you have 2 lines (specifically, lines 354 ,

Java won't run because there a break statement outside a loop, but I have it inside a loop -

i'm having 2 weird errors new error when tell java draw string displays coordinateness of x , y, doesn't. public void paint (graphics g) { super.paint (g); //system.out.println ("boolean: " + this.closedoors); g.drawstring("("+x+","+y+")",x,y); } link program if compile it. http://hotfile.com/dl/107032853/c81d927/pigment.java.html this complete program /* * change template, choose tools | templates * , open template in editor. */ import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.applet.applet; import java.awt.graphics; /** * * @author george beazer */ public class pigment extends japplet { boolean closedoors; private int x = 0; private int y = 0; public static void main(string [] args) { pigment stuff = new pigment(); } public pigment() { setbackground (color.blue); } @override public void init() {

php - How can I override cake FormHelper? -

i need change $form->create behaviour, created helper use instead of native formhelper: slughelper: app::import('helper', 'form'); class slugformhelper extends formhelper { public function create() { return "error"; } } in appcontroller: public $helpers = array('slugform' => 'form'); and in view: $form->create(); but still calls native $form->create(); just thought - shouldn't define helpers in controller doing this: public $helpers = array('slugform', 'form'); rather had "slugform => form". hope helps!

silverlight - Missing credential from request in OOB application -

i'm writing simple silverlight application in have following code, think pretty standard: webrequest.registerprefix("http://", webrequestcreator.clienthttp); var request = new webclient(); var cred = new networkcredential(server.username, server.password); request.credentials = cred; request.usedefaultcredentials = false; request.downloadstringcompleted += testservercompleted; var uri = new uri(server.getrequesturl(methods.ping)); request.downloadstringasync(uri); yet when view request in fiddler, no credentials added headers. missing? shouldn't there "authorization: basic ..." header in there? try this. httpwebrequest.registerprefix("http://", webrequestcreator.clienthttp); httpwebrequest req = (httpwebrequest)httpwebrequest.create(url); req.usedefaultcredentials = false; req.credentials = ew networkcredential(server.username, server.passwor req.contenttype = "text/xml;charset=\&qu

math - How do I convert an IP address into an integer between 1 and 3? -

i'm not mathematician may stupid question...but - there way translate ip addresses integers between 1 , 3, whereby there a) equal distribution of 1's, 2's , 3's , b) each ip address translate same integer? (in essence, hash). i'm using 3 example - ideally i'd range limit customizable. $highest_allowed_integer = 3; $integer = get_evenly_distributed_but_always_identical_integer($_server["remote_addr"],$highest_allowed_integer); thanks! treat entire ipv4 address number in base 256 (that means 4.3.2.1 translate (4 << 24) + (3 << 16) + (2 << 8) + 1 ), mod 3, , add 1. on little digression, might want concept of hashing .

tfs2010 - TFS Migration changetype mapping -

we're using tfs integration tools migrate our source control history tfs 2008 instance tfs 2010 instance. tfs 2008 upgraded tfs 2005 instance, causes problem. in discovery phase of tfs integration tool error: [2/23/2011 4:37:50 pm] tfsmigrationshell.exe information: 0 : versioncontrol: starting analysis of tfs change 5267 [2/23/2011 4:37:50 pm] tfsmigrationshell.exe information: 0 : versioncontrol: unresolved conflict: [2/23/2011 4:37:50 pm] session: dd9ee183-8f17-42e4-acbb-a5bfb0c26d45 [2/23/2011 4:37:50 pm] source: d95a9917-e8ec-46dd-92bb-86120d0b2a2a [2/23/2011 4:37:50 pm] message: unrecognized conflict type [2/23/2011 4:37:50 pm] conflict type: unhandled changetype conflict type [2/23/2011 4:37:50 pm] conflict type reference name: 361cd4e0-9955-42e0-a57c-ec3ade589e77 [2/23/2011 4:37:50 pm] conflict details: changetype 'add, edit, encoding, delete' unrecognized. this specific checkin tfs 2005 instance; assume "encoding" changetype

scala - Lift: how make these relations polymorphic? -

i got entry should related 1 of 3 "lists" call them lista listb listc couldnt figure out how longmappedmapper. how this? i wanted let list have multiple entries without having specify listx relation each kind of list. not : class entry ...{ object lista extends longmappedmapper(this,lista) object listb extends longmappedmapper(this,listb) ... } i want like: class entry ...{ object list extends polylongmappedmapper(this,lista,listb,listc) //polylongmappedmapper example mapper want ... } or: class entry ...{ object list extends polylongmappedmapper(this,baselisttrait) //where baselisttrait trait shared list classes //polylongmappedmapper example mapper want ... } is somewere in lift framework what want? comparable polylongmappedmapper? or there elegant way solve problem? you can in such way: class extends longkeyedmapper[a] idpk { object entry extends longmappedmapper(this, entry) ... class b extends

objective c - Increasing width of UISearchDisplayController PopOver Results -

i have ipad app has uisearchbar in navigation bar. when enter text in search bar results automatically displayed in uipopovercontroller. that's great except popover's default size not wide enough needs. there way set width? apple has done safari's search bar. popover displays search results bit wider default , have removed "results" title popover. you'd need set contentsizeforviewinpopover property of uiviewcontroller that's being displayed in popover. i'm not sure how if it's automagically happening behind scenes.

c++ - Vertex Buffer Objects Open GL -

i new open gl , trying build non deprecated code. can't grasp vbo. got far, can please explain i'm supposed doing. also, have opengl programming guide, if can point out pages read helpful well. #include <gl/glew.h> #include <gl/freeglut.h> gluint id[2]; glfloat positiondata[][2] ={{50,50},{100,50},{50,100}, {100,50}, {100, 100}, {50, 100}}; glfloat colors[][3] = {{0.1, 0.2, 0.3},{0.1, 0.2, 0.3},{0.1, 0.2, 0.3},{0.1, 0.2, 0.3},{0.1, 0.2, 0.3}}; void init(){ glewinit(); glclearcolor(1.0, 1.0, 1.0, 0.0); } void display(){ glclear(gl_color_buffer_bit); glshademodel(gl_flat); glgenbuffers(2, id); glbindbuffer(gl_array_buffer, id[0]); glbufferdata(gl_array_buffer, sizeof(positiondata), positiondata, gl_static_draw); glenableclientstate(gl_vertex_array); glvertexattribpointer(0, 3, gl_float, gl_false, 0, 0); glenablevertexattribarray(0); glbindbuffer(gl_array_buffer, id[1]); glbufferdata(gl_array_buffer, sizeof(colo

php - Preg match where id attribute changes by 1 -

i want innertext of each anchor. , print results. "ctl" in id attribute increased 01 each time though. i have match them id attribute because of page these anchors located. how that? <a id="ctl00_maincontent_rpleaderboard_ctl01_hypservicerecord" href="/stats/reach/default.aspx?player=dj+darkrecon">dj darkrecon</a> <a id="ctl00_maincontent_rpleaderboard_ctl02_hypservicerecord" href="/stats/reach/default.aspx?player=x+pr+legacy+x">x pr legacy x</a> <a id="ctl00_maincontent_rpleaderboard_ctl03_hypservicerecord" href="/stats/reach/default.aspx?player=forgiver2">forgiver2</a> here rather quick solution using html parser: $dom = new domdocument; $dom->loadhtml(' <!doctype html> <a id="ctl00_maincontent_rpleaderboard_ctl01_hypservicerecord" href="/stats/reach/default.aspx?player=dj+darkrecon">dj darkrecon</a> <a id=&q

java - Source not found! -

i'm trying write application opens window when button selected here have far: public class androidalarm extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); button codesbtn = (button)findviewbyid(r.id.imagebutton1); codesbtn.setonclicklistener(new view.onclicklistener() { public void onclick(view argo) { intent = new intent(androidalarm.this, codes.class); startactivity(i); } }); } } this have in default class, activity i'm trying start class called codes: public class codes extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.codes); } } it have functionality right i'm trying open it. codes.java (above) connected lay

php - How can I get PhpStorm to go to the right declaration -

i have following snippet of code. abstract class mrparent { public function __construct() { $this->var = 'a'; } } class mrchild extends mrparent { public function hello() { echo 'hello'; } } $mrguy = new mrchild(); now, in phpstorm, when middle-click ("go declaration") on last line of "mrchild" class, cursor jumps "__construct" line. expecting go "class mrchild extends mrparent" line. in single document, ok, in setup it's 1 class per file, quite annoying because means ide showing me class don't want. i know if added following code "mrchild" class, i'd want, seems shouldn't fixing consider ide bug adding code. public function __construct() { parent::__construct(); } do have suggestion? you facing wi-4880 issue. feel free watch/vote.

vb.net - programing ranging data -

i have 2 inputs 0-180 x , y need add them , stay in range of 180 , 0 having trouble since 90 mid point cant seem keep data in range im doing in vb.net need logic result = (x + y) / 2 perhaps? @ least stay in 0-180 range. there other constraints you're not telling about, since right seems pretty obvious.

Completely remove WiFi from Android Rom (Including Settings Layout) -

i working aosp gingerbread , have built customized rom nexus 1 excludes wifi , camera. however, wifi can still seen in settings menu. how remove settings layout? p.s. want rom 100% free of modules, drivers or libraries two. had commented out use_camera_stub := false boardconfigvendor.mk , replaced wifi related defines board_have_wifi := false in boardconfigcommon.mk before compiling. is modification correct or there better way it? thanks. ok, commented out wifi , wifi settings wireless_setting.xml , wireless_setting.java remove them settings layout.

python - Fetching data from the Wiki -

i developing wiki , keep posting information wiki. however, i'll have fetch information wiki using python code. example, if have wiki page company, coca cola, need information (text) have posted on wiki parsed python program. please let me know if there's way this. thanks! a manner download page urllib or httplib, analyze regexes extract precise information want. may long, it's relatively easy do. maybe there other solutions analyze source of page, parsers or that; don't know enough them.

java - How to check, throw and catch bean's validation ConstraintViolationException -

consider following case: i have "serivce" module has class called clientservice . this clientservice uses class called clientdao in "dao" module. clientdao has method insert(@valid client c) . method throws daoexception . client entity. attributes annotated javax bean validations, @javax.validation.constraints.notnull . if constraint violated, clientservice receives constraintviolationexception . clientservice expects daoexception or other exception of "dao" module. , want keep way, throwing exceptions related directly task object does, hiding implementation details higher layer (in case, "service" module). what encapsulate javax.validation.constraintviolationexception in validationexception of "dao" module, , declare in trows clause, alongside daoexception . , don't want perform validation checks myself (that's why use @valid annotation) here code (abstracting interfaces, injections , else. make simpl

Alternatives to SQL? (Alternative declarative query languages for relational databases?) -

i came across htsql , reminded me of question i've wondered: alternative declarative query languages relational databases out there? complaints exist against sql, i'd expect many, googling has been unfruitful. various programming languages have list/monad comprehensions, i'm looking more actual implementation relational databases. great highlight major differences vs. sql (readability, modularity, concision, etc.). implementation needs open-source, , ideally can use against existing rdbms, e.g. postgresql. here's complete list, links illustrative example code (moved examples in question down here): muldis d : terse perl-inspired syntax; designed practical full scripting language. htsql : terse; optimized foreign key joins; limited expressiveness. mdx : the multidimensional expressions (mdx) language provides specialized syntax querying , manipulating multidimensional data stored in olap cubes.[1] while possible translate of these traditional sql

syntax highlighting - Drupal: Trying to use GeSHi with CKeditor -

i hoping use ckeditor geshi, i'm having major difficulties. happens is, if create new piece of content, then, disable ckeditor i'm writing plain html, can enclose code snipptet in <pre> </pre> tags. if save, geshi thing nicely , snippet looks good. however, if try edit piece of content, ckeditor messes around formatting of code, replacing lot of characters special escape sequences, , trying close thinks html tags c++ include files, e.g. #include <iostream> make ckeditor place </iostream> @ end of text. then, in best scenario code looks bad. in other cases, behaviour's weird: page won't load , gives me server error instead. assume that's because, server side, change ckeditor has made code snippet making geshi crash or vice versa. here's example piece of code looked correct after entered verbatim in plaintext editor , enclosed in <pre> tags: // rights reserved // email: firstname.lastname@url.com //////////////////////

php - how to edit or make your own shipping calculator? -

i want implement own shipping calculator shipping in magento. e.g. on products of price upto 1000, 10% charged, on products of price upto 2000, 20% charged , on ...... so how modify this, , make changes , in whihch files shipping flate rate of $5 showing time :( ?? this wiki page walk through exact process. if have more questions, please post code have attempted.

How to connect android wifi to adhoc wifi? -

greetings, i'm new on android system. correct, android 2.2.1 wifi detects non-ad hoc wireless network? wondering if there's way connect android ad hoc network set-up laptop. your response highly appreciated. thanks, cyril h. you correct not natively supported in android, although google has been saying coming ever since android officially launched. while not natively supported, hardware on every android device released date support it. disabled in software, , need enable in order use these features. it however, easy this, need root, , specifics may different between different devices. best source more informationa this, xda developers: http://forum.xda-developers.com/forumdisplay.php?f=564 . of existing solutions based on replacing wpa_supplicant, , method recommend if possible on device. more details, see http://szym.net/2010/12/adhoc-wifi-in-android/ . update : been few years now, , whenever need ad hoc network connection on phone use cyanogenmod .

tcp - tcpdump always filters my packets -

i've been using tcpdump month now, , recently, has stopped capturing packets not sent or computer running tcpdump. i've stripped down command just: sudo tcpdump -i en2 i've checked interfaces ifconfig, , en2 in "promisc" mode. when specifying specific host filter, see few "arp" messages nothing compared going on in network. any ideas why happening? appreciated if can offer advice! richard ps, sorry re-post, wanted register time! (new s.o.) do know network equipment used \ if there has been change recently? one possible explanation computer connected switch (and not hub) switch sends adapter traffic intended mac address, , broad casts (hence arp) one way check send broad casts other computers in network (just use ping 255.255.255.255 ) , see if can see anything.

c# - How to properly use a LINQ2SQL DataContext object; creating anew each use causes headaches -

so, in learning linq2sql (don't tell me it's dead technology please, i'm not switching ef simple applications) have read numerous times datacontext class meant created , destroyed frequently. great, lightweight object can use access database. however, in practice seems cause nothing trouble. example, if load datagrid changes entity objects don't seem tracked , calling datacontext.submitchanges has no effect: void loadui() { using( var db = new testdatacontext() ) { // use dataloadoptions.loadwith<t> if need // access foreign key/ deferred objects. mastergrid.itemssource = db.customers.tolist(); detailsgrid.itemssource = // set collection of settings // selected user in mastergrid. // simple foreign key relationship } } void updatename( string newname ) { using( var db = new testdatacontext() ) { var customer = ((customer)master

c# - what to look out for when migrating .net apps to Windows 7, 64 bit -

we migrating our desktop windows 7, 64 bit (from 32bit windows xp). have number of winforms c# applications , trying figure out out in upgrade. there suggestions or resources @ developer point of view on out make smooth transition? .net behaves more or less same on 32bit , 64bit os'es, there not worry there afaik. the main things must aware of changes in os itself: the registry changed, if read or write registry settings may have modify code some file locations changed. have program files 64-bit apps , program files (x86) 32-bit apps instance. other system folders have moved. uac may cause trouble. must test this your program may not have rights write locations on file system or in registry. may have ask user permission or require user run application administrator in worst case. those changes can think of @ moment. in cases app run fine on both os'es.

appcelerator titanium cannot parse JSON -

i'm new titanium , difficulty in parsing json mysql export. json valid , feel frustrated many unsuccessful trials. simplify code, put below. code stop , said: [error] script error = unable parse json string var win = titanium.ui.currentwindow; var hotdealjson = "{'hotdeal':[{'place':'bangkok','date':'4d3n','cost':'$4999up'},{'place':'tokyo','date':'3d2n','cost':'$3799up'}]}"; //read json var response = json.parse(hotdealjson); alert(response.hotdeal.length); thanks & regards, richard the json invalid. single quotes should double quotes. a common mistake.

iphone - Save the The Stream From URL -

in project connecting url , watching video mpmovieplayerviewcontroller. not enough me. want save file iphone. have buttons. 1 watch video, other save video. when push button watch watchng it. unable save it. want able watch video later. in view want see saved videos etc. there 1 can me or can show way ? have tried following code phrase when code started, works while (probably download time), when time save bad exc_bad_access error .thanks every one. here code . cfstringref *docsdirectory = (cfstringref)[nstemporarydirectory() stringbyappendingpathcomponent: @"recordedfile.mp4"]; nsstring *tempath=nstemporarydirectory(); nsstring *tempfile=[tempath stringbyappendingpathcomponent:@"recode.mp4"]; nslog(@" dosya adi madi %@",docsdirectory); nsfilemanager *filemanager = [nsfilemanager defaultmanager]; nserror *error = [[nserror alloc] init]; [filemanager removeitematpath:docsdirectory error:&error]; nsurl *url = [nsurl urlwithstring:@"

c# - Generate a unique string based on a pair of strings -

i've 2 strings stringa, stringb. want generate unique string denote pair. i.e. f(x, y) should unique every x, y , f(x, y) = f(y, x) x, y strings. any ideas? compute message digest of both strings , xor values md5(x) ^ md5(y) the message digest gives unique value each string , xor makes possible f(x, y) equal f(y, x). edit: @phil h observed, have treat case in receive 2 equal strings input, generate 0 after xor. return md5(x+y) if x , y same, , md5(x) ^ md5(y) rest of values.

JSP Turkish Character Problem -

i have jsp page running under jboss 4.2.2 server. the structure page this: include head ( head written on page, masterpage in aspx. ) (body ( problem appears )) include foot ( foot written in page. ) the head page contains encoding , meta tags: <%@ page language="java" contenttype="text/html; charset=utf-8" pageencoding="utf-8"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> when write characters in page such şğĞİÇçÖ (turkish) characters shown "?" ( question mark ) should avoid behavior? how can have text shown writen in jsp page? i see 2 potential causes: your editor didn't save page utf-8. check default settings and/or save as option. the @page missing in of jsps. has present in all jsp files, includes. unrelated concrete problem, following in top of jsp been enough: <%@ page pageencoding="utf-8&

asp.net - set unchecked value of checkbox -

is there way of setting default unchecked value of checkbox? not using databound control. passing data form , pass false opposed null when unchecked. yes, using default htmlhelpers achieve you <%: html.checkbox("mycheckbox") %> or razor @html.checkbox("mycheckbox") the checkbox() method render input type="hidden" field along side input type="checkbox" submit value false when checkbox unchecked. <input id="mycheckbox" name="mycheckbox" type="checkbox" value="true" /> <input name="mycheckbox" type="hidden" value="false" /> if want submit value other false should render checkbox , hidden field setting value of hidden field default value. note must have same name attribute.

svn - Subversion Apache2.2 LDAPS authentication failed -

os: redhat linux subversion: 1.5.0 apache: 2.2.17 httpd.conf: ldapsharedcachesize 200000 ldapcacheentries 1024 ldapcachettl 600 ldapopcacheentries 1024 ldapopcachettl 600 <location /svn> dav svn svnparentpath /home/svnroot/repository authzsvnaccessfile /home/svnroot/repository/svn_access_file authtype basic authbasicprovider ldap authzldapauthoritative off authldapurl "ldaps://master.ldap.ebupt.com:636/ou=staff,dc=ebupt,dc=com?uid?sub?(objectclass=*)" ss l authname "subversion.resository" require valid-user </location> apache error_log: [thu feb 24 16:48:00 2011] [debug] mod_authnz_ldap.c(403): [client 10.1.85.181] [25242] auth_ldap uthenticate: using url ldaps://master.ldap.ebupt.com:636/ou=staff,dc=ebupt,dc=com?uid?sub?(objectcl ass=*) [thu feb 24 16:48:00 2011] [info] [client 10.1.85.181] [25242] auth_ldap authenticate: user jinjian kang authentication failed; uri /svn [ldap: ldap_simple_bind_s() failed][can't contact ldap server] p

inline css problem -

i have following script: http://jsfiddle.net/oshirowanen/8mq7x/1/ which works fine, change external css add background image using inline css methods, stops working, demonstrated here: http://jsfiddle.net/oshirowanen/8mq7x/ i need part of inline css because html dynamically generated. trying create many generic icons using different images each icon, using generic css external file cause mouse on effect. why stop working when inline css used add image , how can work? because elements style css rule has higher priority other css rules. background in element style rewriting not default background, :hover too. you should rewrite background-image . example: http://jsfiddle.net/8mq7x/3/

Android application working in emulator but not in device -

i have created aa android application using android 1.6 (api 4) , android:minsdkversion "3". using emulator run application 2.2. working fine in emulator. installed in htc hero (android 1.5) , showing force shut down error. why so? please give me reason or solution problem. regards kris you take emulator 1.5, see you're error it. carreful element of interface allowed 1.6, aren't in 1.5.

php - Zend_Navigation: Getting Only the Pages Accessible by the Current User/Role -

i have zend_navigation running data provided navigation.xml file. let's assume first level (0) consists of 2 pages, frontend , backend. frontend accessible guest role, backend admin role. if a <?php echo $this->navigation()->menu()->setmaxdepth(0); ?> it correctly displays "frontend" link when not logged in, , both "frontend" , "backend" links when logged in admin. however, displaying "frontend" link doesn't make sense guests, because don't have other pages navigate on level anyway. rather not display navigation @ guests. i know do <?php if ('guest' !== $this->view->role) { echo $this->navigation()->menu(); } ?> but i'm hoping better way this. what i'm looking like <?php if (count($this->navigation()->getpagesforrole($this->view->role)) > 1) { echo $this->navigation()->menu(); } ?> i can't figure out how achieve api provided