Posts

Showing posts from February, 2012

c++ - Convert CString to std::wstring -

how can convert cstring std::wstring ? to convert cstring std::wstring : cstring hi("hi"); std::wstring hi2(hi); and go other way, use c_str() : std::wstring hi(l"hi"); cstring hi2(hi.c_str());

ruby - Rails Script Segmentation Fault with RVM -

i getting segmentation fault. should which ruby return /usr/local/bin? maletor$ rails generate mailer contactmailer /users/maletor/.rvm/gems/ruby-1.9.2-p0/gems/mysql2-0.2.4/lib/mysql2/mysql2.bundle: [bug] **segmentation fault** ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] abort trap maletor$ rails /usr/bin/rails maletor$ gem env rubygems environment: - rubygems version: 1.3.7 - ruby version: 1.9.2 (2010-08-18 patchlevel 0) [x86_64-darwin10.4.0] - installation directory: /users/maletor/.rvm/gems/ruby-1.9.2-p0 - ruby executable: /users/maletor/.rvm/rubies/ruby-1.9.2-p0/bin/ruby - executable directory: /users/maletor/.rvm/gems/ruby-1.9.2-p0/bin - rubygems platforms: - ruby - x86_64-darwin-10 - gem paths: - /users/maletor/.rvm/gems/ruby-1.9.2-p0 - /users/maletor/.rvm/gems/ruby-1.9.2-p0@global - gem configuration: - :update_sources => true - :verbose => false - :benchmark => false - :backtrace ...

mysql - pivot table: getting data from one column -

lets table like: date status 2010-01-02 2010-01-03 accept 2010-01-03 accept 2010-01-03 reject 2010-01-03 2010-01-04 reject i want if value null, means accept. beside want show result like: date accept reject 2010-01-02 1 0 2010-01-03 3 1 2010-01-04 0 1 it means, calculate amount of either accept or reject contained in status column. how do that? select date date, sum( if( status = 'accept', 1, 0 ) ) accept, sum( if( status = 'reject', 1, 0 ) ) reject pivot group date updated** , working

architecture - "if" considered harmful in ASP.NET MVC View (.aspx) files? -

i remember seeing blog (or something) said should not use <% if ... %> in .aspx files in asp.net mvc, can't remember said alternative is. can remember seeing , point me it? i'm not sure if saw, here blog mentions it. see item #11.

flex - save state of a dataGrid: visible columns, columns width and order -

i want save remotely (on database) state (visible columns, columns width , order) of flex3 datagrid. for width , visibility can save them accessing each column attribute.. ugly possible.. order? have create datagrid dynamically?? any idea appreciated thanks in case have saved order header name (i'm making assumption datagrid has same columns , header names). (var n:number = 0; n< datagrid.columns.length; n++) { var thiscol:datagridcolumn = datagridcolumn(datagrid.columns[n]); colarray.additem(thiscol.headertext); } then can restore column order retrieving ordered list of column headers, , swapping position of columns in datagrid required. (var n:number = 0; n < colarray.length; n++) { movecolumnto(string(colarray.getitemat(n)), n); } i have defined function movecolumnto() perform switch. private function movecolumnto(columnname:string, columnindex:number):voi...

c# - how to find child nodes at root node [TreeView] -

root b c d e t f g x i want find e node's parent nodes(it number 5). then, i'll save node. if number smaller 5. i'm using treeview in asp.net control. i suggest using recursive iterations. private treenode findnode(treeview tvselection, string matchtext) { foreach (treenode node in tvselection.nodes) { if (node.tag.tostring() == matchtext) { return node; } else { treenode nodechild = findchildnode (node, matchtext); if (nodechild != null) return nodechild; } } return (treenode)null; } you can utilize logic determine many things node , structure allows expand can node , criteria wish search for. can edit example fit own needs. thus, example pass in e , expect have node e returned if parent property of node returned parent after. tn treenode = findnode(mytree...

sql - Datediff between non-consecutive rows in a table -

i take average of time difference table1 below. values not consecutive , time value repeated, need 1) sort time, 2) discard non-unique values, 3) perform time difference (in milliseconds), 4) average resulting time difference values. further i'd 5) limit datediff operation chosen time range, such _timestamp >= '20091220 11:59:56.1' , _timestamp <= _timestamp >= '20091220 11:59:56.8'. pretty stumped how put together! table1: _timestamp 2009-12-20 11:59:56.0 2009-12-20 11:59:56.5 2009-12-20 11:59:56.3 2009-12-20 11:59:56.4 2009-12-20 11:59:56.4 2009-12-20 11:59:56.9 here's 1 works , not ugly: ;with time_cte ( select min(_timestamp) dt, row_number() on (order min(_timestamp)) rownum table1 group _timestamp ) select t1.dt startdate, t2.dt enddate, datediff(ms, t1.dt, t2.dt) elapsed time_cte t1 inner join time_cte t2 on t2.rownum = t1.rownum + 1 will give following output example: sta...

.net - System.IO.UnmanagedMemoryStream - why Byte* instead of IntPtr -

anybody have idea why bcl team chose use byte* instead of intptr in constructors unmanagedmemorystream? forces using unsafe context in order construct type. seems have used intptr , wouldn't have forced unsafe context. i'd guess because safer. if have used intptr, constructor called garbage value. byte* there's @ least shot @ compiler verifying memory valid , pinned. albeit casting intptr byte* pretty simple.

r - Using the 'available.packages' Function to Retrieve Emails -

i attempting retrieve email addresses of contributing package authors , maintainers r-project. function reads follows: availpkgs <- available.packages(contriburl = contrib.url(getoption("repos"), type), method, fields = null, type = getoption("pkgtype"), filters = null) i've attempted different character values in fields parameter retrieve maintainer , author info 'packages' files, have not been had luck. know how might approach this? thank in advance time. i not think author information in available.packages() retrieves: r> ap <- available.packages() r> colnames(ap) [1] "package" "version" "priority" [4] "bundle" "contains" "depends" [7] "imports" "linkingto" "suggests" [10] "enhances" "os_type" "license" [13] "file" "repository" r...

user interface - What are your thoughts on page scrolling in a business application? -

let's designing web application internal business use. should page designed not scroll, , either use paging or have scrollable sub-sections (tables, grids, etc) or better allow page simple scroll. what happens when have long page requires save/cancel button or other such buttons. need scroll way bottom find said buttons. or repeat buttons on top , bottom? sorry post not worded well. hastily written. gist of it. thanks. designing application there no need scroll - especiallay in web applications people miss elements outside "view-range". scrolling can annoying , might indicator content on website. you try use expandable areas different categories or tab-catalogue. wizard possibility. another possibility locking buttons on bottom of browser (not of page itself). there scrollable area actual content , belwo buttons.

jquery - select hidden input in div, unable to find; however source shows input tag in div -

this page looks like <div id="divid"> <input type="hidden" id="hidden1" value="value1" /> <input type="hidden" id="hidden2" value="value2" /> <bunch of other tags> </div> when $("#divid").find("input#hidden1").val() i'm getting undefined. when $(":input#hidden1").val() i'm getting value1 investigating further, $("#divid").html() returns hidden inputs not in sight. i can confirm input tags inside div. update input fields getting moved out of div , head of page reason. moving input fields bottom of div kept them wandering , allowed me functionality looking for. as far how or why happening, haven't foggiest idea. issue occured ie 8.0.6. if can point me sort of bug report issue or explain how and/or why i'll accept answer. if .html() call returns no inner elements well, seems they're ...

c# - How does String.Contains work? -

possible duplicate: what algorithm .net use searching pattern in string? i have loop in program gets line file. there check whether line contains string if(line.contains("string")) { //do other stuff } there on 2 million rows in file if can quicken speed 1/10th millisecond save me on 3 minutes on each run. so... line 1000 chars long, quicker short or long string, or not make difference? line.contains("abcdefghijklmnopqrstuvwxyz"); or line.contains("abcdefg") thank in advance. string.contains() follows torturous route through system.globalization.compareinfo clr , nls support sub-system thoroughly got lost. contains highly optimized code impressive perf. way faster through pinvoking standard crt function wcsstr, available in msvcrt.dll [dllimport("msvcrt.dll", charset = charset.unicode)] private static extern intptr wcsstr(string tosearch, string tofind); it returns intptr.zero if string wa...

c# - To check if session is available or not -

i tried code in application_error this session["mysession"] = "some message"; but problem session not available in application_error . want check whether session available or not. session doesn't exist within context of current application_error . try following: protected void application_error(object sender, eventargs e) { if (context.handler irequiressessionstate || context.handler ireadonlysessionstate) { // session exists session["mysession"] = "some message"; } }

Java automatically adjusting to the Windows 7 font size adjustment -

Image
in windows 7, if change font size via control panel->appearance , personalization -> display "make text , other items larger or smaller", adjusts not menu sizes, text content size of apps notepad, wordpad, firefox. is there way java automatically scale font without having manually scale it? there 2 parts this: getting components, fonts, etc scale getting layouts scale for swing, first part easy - starts 1 call. uimanager.setlookandfeel(uimanager.getsystemlookandfeelclassname()); on windows, cause respect small/large fonts (dpi) setting. here 2 screenshots quick test app threw together, demonstrating how looks on machine in windows 7 @ 96dpi (normal font size) , @ 144dpi (150%) first default font size sample: now larger (150%) font size set: there no code change between runs, logging out & in new dpi settings. set fixed frame size on purpose demonstrate container not scaling in size, caused label pushed down in order fit. here ...

jquery - hover() backgroundColor problem -

$('li > a').hover( function(){ $(this).animate({ backgroundcolor: '#2a639a', color: '#fff' },300).corner('5px'); }, function(){ $(this).animate({ background: 'transparent', color: '#444' },300); } ); what's wrong background: 'transparent'? turns white, not transparent important thing note: transparent in css different 0% opacity. opacity can graduated, whereas tranparent either on or off. therefore cannot animate transparent or solid colour , expect smooth transition. if try, browsers treat either black or white purposes animation, think you're seeing here. animating opacity instead may give smoother transition, though of course different (for starters affects whole element, not background, plus there browser compatibility issues consider).

operating system - Is it possible to detect if the hardware display has completed the process of switching between display modes? -

the reason ask because bought new lcd takes approximately 5 seconds change between display modes, such 1920x1080x32bpp 1280x800x32bpp. programmatic solution exist detect if display ready video output? i believe answer 'no'. once display adapter starts transmitting new signal in new refresh rate, etc., has absolutely no way of knowing how long takes display internally process change , start showing image. hardware limitation both dvi , vga signals, not software one.

How can I list all files in a directory using Perl? -

i use like my $dir="/path/to/dir"; opendir(dir, $dir) or die "can't open $dir: $!"; @files = readdir dir; closedir dir; or use glob , anyway, need add line or 2 filter out . , .. quite annoying. how go common task? i use glob method: for $file (glob "$dir/*") { #do stuff $file } this works fine unless directory has lots of files in it. in cases have switch readdir in while loop (putting readdir in list context bad glob ): open $dh, $dir or die "could not open $dir: $!"; while (my $file = readdir $dh) { next if $file =~ /^[.]/; #do stuff $file } often though, if reading bunch of files in directory, want read them in recursive manner. in cases use file::find : use file::find; find sub { return if /^[.]/; #do stuff $_ or $file::find::name }, $dir;

.net - Detect when drive is mounted or changes state (WM_DEVICECHANGE for WPF)? -

i writing directory selector control wpf, , add/remove drive directory tree when gets mounted or unmounted or when becomes ready or not ready (e.g. user inserts or removes cd). looking system event similar wm_devicechange . konstantin i used wmi implement (like richard stated in answer) using system.management; using system; ... private void subscribetocdinsertion() { wqleventquery q; managementoperationobserver observer = new managementoperationobserver(); // bind local machine connectionoptions opt = new connectionoptions(); opt.enableprivileges = true; //sets required privilege managementscope scope = new managementscope("root\\cimv2", opt); q = new wqleventquery(); q.eventclassname = "__instancemodificationevent"; q.withininterval = new timespan(0, 0, 1); // drivetype - 5: cdrom q.condition = @"targetinstance isa 'win32_logicaldisk' , targetinstance.drivetype = 5"; var w = ne...

asp.net - Retrieve the full output from a web application with MSBuild -

i have misunderstanding msbuild. want build web application (with traditional .csproj project file) , "entire output" of build in new, clean output folder - including website files included in project <content include="... . the aspnetcompiler utility makes easy "web site" style projects - specify input folder , output folder, , can entirely different. so far i've had success specifying outoutpath folder, i.e. moving bin folder - gives me binaries , ignores aspx, image files, etc. i must missing obvious, or fundamental! indeed. i found couple of relatively obscure references issue on web. i found set (apparently undocumented!) property webprojectoutputdir along standard outputpath property, so: <msbuild projects="..." properties="webprojectoutputdir=d:\output;outputpath=d:\output\bin" /> i guess property used in microsoft.webapplication.targets or somewhere. if enlighten me further this,...

imagemagick - PDF: How to Optimize Filesize & Convert to PNG (embedded fonts problem) -

i have pdf embedded fonts can't seem work with. right now, i'm using ghostscript , trying 2 things: minimize filesize of pdf: gswin32c -dsafer -dbatch -dnopause -dquiet -sdevice=pdfwrite -soutputfile=output.pdf input.pdf convert pdf png (super sample, used creating other thumbnails): gswin32c -dsafer -dbatch -dnopause -dquiet -dfirstpage=1 -dlastpage=1 -r288 -sdevice=png16m -soutputfile=output.pdf input.pdf the above works when working on scanned documents. when run them against pdfs embedded fonts (the pdf generated on fly application), fails. here's error get: gpl ghostscript 8.71: warning: 'loca' length 274 greater numglyphs 136 n font uughde+arialmt. gpl ghostscript 8.71: warning: 'loca' length 274 greater numglyphs 136 n font uughde+arialmt. gpl ghostscript 8.71: warning: 'loca' length 188 greater numglyphs 93 in font uughde+arial-boldmt. gpl ghostscript 8.71: warning: 'loca' length 188 greater numglyphs 93 in font uug...

caching - Forcing user's browser to save files to cache -

my website online music portal online playing system. when user play song, served nginx server on port 8080 on server. the problem when song has finished playing, player repeats song. every time replays, makes call server , starts downloading file again play. previously had apache serve these files. @ time, user requested file once , replays played cache. how can achieve using nginx [i not using script php or serve file. it's direct link. http://www.myserver.com:8080/music/song1.mp3] it lot see of former apache configuration , current nginx configuration see how they're set put expiration headers on outbound files. isn't foolproof way enforce caching, may know, sounds "good enough" work you. try nginx configuration block within server{} block reads this: location ~* \.(mp3)$ { expires max; } that should set far-future expiration date on files , encourage browser cache them longer.

osx - How to run mvim (MacVim) from Terminal? -

i have macvim installed , trying set editor git (version control), can't run 'mvim' command line isn't recognised. how setup mvim can run terminal? there should script named mvim in root of .bz2 file. copy somewhere $path ( /usr/local/bin ) , should sorted.

php - How to check a PNG for grayscale/alpha color type? -

php , gd seem have trouble creating images pngs of type greyscale alpha when using imagecreatefrompng() . results incredibly distorted. i wondering if knew of way test colour type in order notify user of incompatibility? example: original image: http://dl.dropbox.com/u/246391/robin.png resulting image: http://dl.dropbox.com/u/246391/robin_result.png code: <?php $resource = imagecreatefrompng('./robin.png'); header('content-type: image/png'); imagepng($resource); imagedestroy($resource); cheers, aron the colour type of png image stored @ byte offset 25 in file (counting 0). if can hold of actual bytes of png file, @ byte 25 (i don't php, don't know how that): 0 - greyscale 2 - rgb 3 - rgb palette 4 - greyscale + alpha 6 - rgb + alpha the preceding byte (offset 24) gives number of bits per channel. see the png spec more details. in slight twist png file may have "1-bit alpha" (like gifs) having trns chunk (w...

xslt - successor of msxsl.exe? -

we intend migrate our framework msxml4 msxml6. using msxsl.exe yet. seems support msxml versions 4.0, command line msxsl.exe -u version 6.0 tells me. there successor of msxsl.exe? alternative command line processor? there number of ways replace existing processor, depends on level of functionality require , whether need msxml specific functionality. example there xsltproc part of libxslt (can windows binaries here example). this page gives quick replacement in c# both change command line usage , might not implement same msxml extensions (xsltproc doesn't). if interested in simple command line processor uses msxml 6 worse using simple jscript application. save following code xsltr.js , run cscript msltr.js input.xml template.xsl output.txt : var adtypebinary = 1; var adsavecreateoverwrite = 2; var adsavecreatenotexist = 1; try { var args = wscript.arguments; if(args.length < 3) { wscript.echo("usage: xsltr.js file.xml file.xsl outp...

java - Tool to view objects in permgen -

i have problems permgen overflow. tools can use view classes loaded permgen , how memory use? thanks. maybe have large code base or interning lots of strings. try jmap : jmap -permstat <pid> (note: permstat option not available in windows) example: $ jmap -permstat 22982 attaching process id 22982, please wait... debugger attached successfully. server compiler detected. jvm version 17.0-b16 100691 intern strings occupying 5641096 bytes. finding class loader instances ..finding object size using printezis bits , skipping over... done. computing per loader stat ..done. please wait.. computing liveness..done. class_loader classes bytes parent_loader alive? type <bootstrap> 303 1355992 null live <internal> 0xdd159fe8 9 94104 0xdd153c30 live sun/misc/launcher$appclassloader@0xae7fcfa0 0xdd153c30 0 0 null live sun/misc/launcher$extclassloader@0xae7b0178 total = 3 ...

html5 - How can I get debugging output from IE 9? -

i trying make website uses <canvas> element , javascript learn new things. it works inside of chrome , firefox, internet explorer 9 hangs on it. neither chrome nor firefox give me sort of error output in consoles , ie9 crashes without giving debug output. is there way debug dump or attach debugger ie9 can figure out why page crashing? maybe try console tab . wouldn't stress if can't app run in ie9 it's in beta. golf clap trying stay ahead of browser version curve, though.

objective c - How to call function of one class from another class programatically -

i called function of 1 view controller class other view controller in nib file using first responder before.but want programatically. suppose,i have 2 controller class named , b.where b root controller.i have button(added programatically)named (btn) in controller class.now want call function( funcb) of class b when pressed btn of class a.how can this?? i dont have nib file in class a. plz ans question. advanced ur reply. i'm not sure whether i've interpreted question correctly, if b object instance of b class, , methodb method of b class, can call methodb via: [b methodb]; i assuming "function", mean "method"...?

ruby on rails - Authentication failing on production server -

on development machine can login fine, once on production, authentication fails base user created in migration. i can reset password , upon doing auto logged in, when logout , try login again using newly entered password, once again tells have bad email and/or password. any ideas why be? === update class user < activerecord::base # default devise modules devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable ... end i have same problem on staging server. strangest works in production env on personal computer ... solved here : http://groups.google.com/group/plataformatec-devise/browse_thread/thread/20a73a2b7976806f thanks !

iphone - Something is wrong with my plist file? But what is it? -

could please me figure out wrong program, , how o fix it!? warning: copy bundle resources build phase contains target's info.plist file 'secret-info.plist'. please help! the info.plist file mustn't checked member of target.

Does Python use a compiler or interpreter or a combination? -

possible duplicate: cpython bytecode interpreter? my question is: does python use compiler, interpreter or combination of them? python uses virtual machine aproach (as php, ruby, .net languages etc), python implementation uses compiler create intermediate language executed on virtual machine.

jQuery UI Autocomplete with a JSON datasource generated from Rails - not working -

i'm trying set input tag jquery autocomplete function, it's doesn't work when im referring external json data. works perfectly, however, local json-like array... let me explain in code: html file: <html> <head> <meta charset="utf-8"> <script src="jquery-1.4.2.min.js" type="text/javascript"></script> <script src="jquery-ui-1.8.5.custom.min.js" type="text/javascript"></script> <script> $(function() { $("#birds").autocomplete({ source: "http://localhost:3000/autocomplete_searches/index.json", minlength: 3 }); }); </script> </head> <body> <div class="ui-widget"> <label for="birds">birds: </label> <input id="birds" /> </div> </body> </html> autocomplete_searches_controller.rb in rails app class autocompletesearchescontroller <...

bbcode - BB Code issue PHP -

alright using little bbcode function forum have, working well, if, in example, put [b]text[/b] it print text in bold. my issue is, if have code: [b] text[/b] well not work, , print it's right now. here example of function using: function bbcode ($string) { $search = array( '#\[b\](.*?)\[/b\]#', ); $replace = array( '<b>\\1</b>', ); return preg_replace($search , $replace, $string); } then when echo'ing it: .nl2br(stripslashes(bbcode($arr_thread_row[main_content]))). so question be, necessary bbcode works inside it, no on same line. in example: [b] text [/b] would be text thank help! alex you need multiline modifier , makes pattern #\[b\](.*?)\[/b\]#ms (note trailing m )

ruby on rails - Link_to doesn't work when using acts-as-taggable-on with custom method -

or rather don't know how specify route it. i have controller setup us: def tags @clients = current_user.clients.find_tagged_with(params[:tag]) end and views tags: <% tag in @client.tags %> <%= link_to tag.name, clients_path(:view =>'tag', :tag => tag.name) %> <% end %> only problem link (clients_path) goes index , not 'all.' know has changing clients_path somehow tell use 'all'. don't know how. any help? thanks you can check routes using rake routes . i'm not sure mean 'all' if custom method added routes, should able use all_clients_path instead of clients_path .

optimization - SQL Server 2008 Optimize FULL JOIN with ISNULL statements -

hi all i hoping me improve query have run periodically. @ moment takes more 40 minutes execute. uses full allocated memory during time, cpu usage meanders @ 2% - 5%, every , jumping 40% few seconds. i have table (simplified example): create table [dbo].[datatable] ( [id] [int] identity(1,1) not null, [dteeffectivedate] [date] null, [dteprevious] [date] null, [dtenext] [date] null, [age] [int] null, [count] [int] null ) on [primary] go here input values: insert [yourdb].[dbo].[datatable] ([dteeffectivedate] ,[dteprevious] ,[dtenext] ,[age] ,[count]) values ('2009-01-01',null,'2010-01-01',40,300), ('2010-01-01','2009-01-01', null,40,200), ('2009-01-01',null, '2010-01-01',20,100), ('2010-01-01','2009-01-01', null,20,50), ('2009-01-01',null,'2010-01-01',30,10) go each entry has dteeffectivedate f...

html - Width of a <td> is narrower when I use a <br> in it on a fixed width <table>. Why? -

Image
i have html code fragment (in valid document using strict doctype): <p>without &lt;br /&gt;</p> <table border="1" width="220"> <tbody> <tr> <td>lorem</td> <td>ipsum</td> <td>lorem ipsum</td> <td>lorem</td> <td>ipsum</td> </tr> </tbody> </table> <p>with &lt;br /&gt;</p> <table border="1" width="220"> <tbody> <tr> <td>lorem</td> <td>ipsum</td> <td>lorem<br>ipsum</td> <td>lorem</td> <td>ipsum</td> </tr> </tbody> </table> this rendered in browser: please note third <td> wider in first table, because haven't used <br> tag there. otherwise code 2 tables identical. i find way have table rendered...

Optimization of MySQL search using "like" and wildcards -

how can queries like select * sometable somefield '%value%' be optimized? the main issue here first wildcard prevents dbms using index. edit: more, somefield value solid string (not piece of text) fulltext search not performed. two ways: (1) use in-memory table goes fast. (2) cook better index , search algorithm foo '%bar%' . it's not possible make suggestions without knowing more problem. as have pointed out, %bar% pattern guarantees table-scan every lookup, nullifies possible search ingenuity in database software.

c# - Is there a bug in this code from 101 LINQ Samples on MSDN? (Update: Fixed) -

Image
note: charlie calvert replied below 101 linq samples have been updated correct code. the msdn visual c# developer center has section called 101 linq samples . found through bing search. the code selectmany - compound 1 is: public void linq14() { int[] numbersa = { 0, 2, 4, 5, 6, 8, 9 }; int[] numbersb = { 1, 3, 5, 7, 8 }; var pairs = in numbersa, b in numbersb < b select new {a, b}; console.writeline("pairs < b:"); foreach (var pair in pairs) { console.writeline("{0} less {1}", pair.a, pair.b); } } however, this code won't compile . noticed if remove comma @ end of from in numbersa, , instead add from in front of b in numbersb , compile , work fine: var pairs = in numbersa b in numbersb < b select new {a, b}; i'm not sure if bug in msdn's example or if possibly i'm running version of c# , .net d...

asp.net - Passing value from popup window to parent form's TextBox -

work on asp.net visual studio 2008 c#. have page. page need call page on popup. on popup page selected value set on parent page text control. one parent page one child page. call parent child popup. on popup window contain grid. on popup grid have command select,click on select close popup , selected value set on parent page text control. i have done steps 1,2,3 , 4. need complete step no 5. on parent page: <script type="text/javascript"> function f1() { window.open("child.aspx"); } </script> <asp:textbox id="textbox1" runat="server"></asp:textbox><input type="button" onclick="f1();" value="pop up" /> on child page: <script type="text/javascript"> function f2() { opener.document.getelementbyid("textbox1").value = "hello world"; } </script> <input type="button" value=...

popup - PowerShell get running explorer process and their documents -

how can access document property of running explorer processes. using following line of code process. $ie2 = get-process |where {$ .mainwindowtitle -eq "windowtitletext"} | {$ .id -ne $ieparentprocessnumber} now want processing on processes $ie2.document etc. it seems trying access document (i.e webpage's data) directly process. not possible using get-process. you need create instance of ie com object example or use system.net.webclient if want read data web site. post more info trying , can possibly out better

sql - How to fetch records form three table -

table name :: feedback_master fields 1. feed_id 2. roll_id 3. batch_id 4. sem_id (semester id) 5.f_id (faculty id) 6. sub_id (subject id) 7. remark. 8. b_id table name :: subject_master fields sub_id (subject id) sub_name (subject name0 f_id ( faculty id) table name :: faculty_master fields f_id (faculty id) f_name (faculty name) l_name (faculty name) b_id this 3 tables. want fetch detail 3 table. i want output as f_name (faculty name), sub_name (subject name ) , remark (remark ) could 1 me on come problem. something like... select fm.remark, sm.sub_name, fcm.f_name feedback_master fm left join subject_master sm on fm.sub_id = sm.sub_id left join faculty_master fcm on fcm.f_id = sm.f_id

asp.net mvc 2 - Post with MVC 2, including values outside of form -

i'm pretty new mvc 2 , i'm having problems figuring out how post values lies outside form. this code simplified: <input type="text" id="textboxoutsideform"/> <% using (html.beginform("edit", "home", formmethod.post)) {%> <%: html.validationsummary(true) %> <%: html.textboxfor(model => model.stuff) %> <input type="submit" value="save" /> <% } %> textboxoutsideform can changed user , when pushing save want include value control action in controller. great if use model binding @ same time. great: [httppost] public actionresult edit(int id, model model, string valuefromtextbox) or formcollection , value.. know in simplified example put textbox inside of form, in real life control 3rd party , creating loads of of other stuff, need grab value jquery maybe , post it.. is possible? thanks if use normal form post inputs inside form sent se...

c# - WPF StringCollection + TextBox -

applicationsetting: renamesettings - system.collections.specialized.stringcollection - user - *wall of text" <application x:class="app.app" ... xmlns:properties="clr-namespace:app.properties" startupuri="mainwindow.xaml"> <application.resources> <properties:settings x:key="settings" /> </application.resources> </application> <window x:class="app.mainwindow" ... xmlns:p="clr-namespace:app.properties" height="{binding source={staticresource settings}, path=default.height, mode=twoway}" minheight="300" ... > <window.resources> <p:settings x:key="settings" /> </window.resources> <grid datacontext="{staticresource settings}"> <menu ... ... /> <label ... /> <textbox margin="1...

html - How to improve remember password option when you have different logins for different subdirectories? -

browser remember password feature nice 1 has problem when have several logins several sections, like: / - 1 login /private/ - login /admin/ - login the problem can in order make browser smarter , proper rember/autocomplete of user/passwords each section. i'm interested chrome , firefox :) my guess browser remember based on or of below: hostname (i.e. domain.com) path (i.e. /admin name , id of input field (i.e. ) if have 3 different logins , want remember separate passwords i'd suggest alternating among above (e.g. change name/id differs). if have 1 single login on 3 separate urls (that same), i'd suggest merging 1 url , form remember. hopefully helps!

Silverlight: VisualState Animation Being Overridden Somehow -

i've got rather complicated custom control boggle mind if showed of code. ;) in general it's panel displaying multiple controls. can think of custom list box. (please don't tell me use listbox, i've been there , doesn't meet needs completely). so, set animations in visualstatemanager. here's happens: when hover on 1 of child controls, expect mouseover state fire. does. when select 1 of child controls expect selected state fire , does. when select different child control, selected state fires well when go first child control selected, , select it, selected state shown fire (by debug statements in code) mouseover animation displayed. is there issue animations able overridden somehow or problem between mouseover , selected states i'm not aware of? here's vsm markup: <visualstatemanager.visualstategroups> <visualstategroup x:name="commonstates"> <visualstate x:name="normal...

ssis - Performing bulk processing in ASP.NET page -

we need ability send out automatic emails when dates occur or when business conditions met. setting system work existing asp.net website. i've had chat 1 of other devs here , had discussion of of issues. things note: all information need modelled in asp.net website there business-logic required email generation in website already we decided ideal solution have separate executable scheduled run overnight , processing , emailing. solution has 2 main problems: if website updated (business logic or model) executable accidentally missed executable stop sending emails, or worse, sending them based on outdated logic. we hoping use this use usercontrols template emails, don't believe possible outside of asp.net website the first problem have been avoided build , deployment scripts (which we're looking @ moment anyway), don't think can around second problem. so solution decided on have asp.net page called regularly ssis , have set amount of processing (say...

iphone - Detecting touches for layers within a UIScrollView -

i have uiscrollview contains number of thumbnails should detect touch event, perform 3d transformation on , call delegate method. the 1 problem unable overcome detecting sublayer being tapped. setting layer.name index count , subclass of uiscrollview touch event. last remaining obstacle how hittest on sublayers name property , voila! i thinking of subclassing uiview container of calayer , capturing touch event way. hoping there might more economical way determine sublayer being touched. the code have been trying (in uiscrollview subclass): -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event { if ([touches count] == 1) { (uitouch *touch in touches) { cgpoint point = [touch locationinview:[touch view]]; calayer *alayer = [self.layer hittest:point]; if (alayer) nslog(@"layer %@ touched",alayer.name); else nslog(@"layer not detected"); } } } i getting 2 compile errors. ...

java - iteration problem -

i have iterate through list error.getge.getlist returns me arraylist of type ge bean,how iterate on list ? for (ge bean: error.getge().getlist()){ // ge } this construct called for-each-loop, , has been available since java5.

Trouble making a running total in C -

i'm new @ programming, new on site too, hello... i'm attempting obtain running total integers 1 thru 10, i'm getting gibberish answers , can't understand why. attempt find out going wrong, added printf(" running total %d\n", sum); line while loop, got more of same nonsense... please see http://codepad.org/uxew6pfu results.... i'm sure has blindingly obvious solution...i'm dumb see though! know i'm doing wrong? #include <stdio.h> int main(void) { int count,sum,square; int upto=10; count = 0; square = 0; while (++count < upto) { square = count * count; printf("square of %d %d",count,square); sum =square + sum; printf(" running total %d\n", sum); } printf("overall total of squares of integers 1 thru 10 %d\n", sum); return 0; } you need ...

keyboard - Ignore auto repeat in X11 applications -

if press , hold key in x11 while autorepeat enabled, continuously receive keypress , keyrelease events. know autorepeat can disabled using function xautorepeatoff() , changes setting whole x server. there way either disable autorepeat single application or ignore repeated keystrokes? what i'm looking single keypress event when key pressed , single keyrelease event when key released, without interfering x server's autorepeat setting. here's minimal example going (mostly beginner xlib tutorial ): #include <stdio.h> #include <stdlib.h> #include <x11/xlib.h> #include <x11/xutil.h> #include <x11/xos.h> #include <x11/xatom.h> #include <x11/keysym.h> display *dis; window win; xevent report; int main () { dis = xopendisplay (null); // xautorepeaton(dis); win = xcreatesimplewindow (dis, rootwindow (dis, 0), 1, 1, 500, 500, 0, blackpixel (dis, 0), blackpixel (dis, 0)); xselectinput (dis, win, keypressmask...

php - posting data to a web page,need an alternative -

to request data web server, can use method,like www.example.com/?id=xyz but want request data www.example.com/xyz how can achieved in php? create file in root directory , call .htaccess. put in it: rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /index.php?$1 [r=301,l] if goes www.example.com/xyz , xyz not directory or file load /index.php?xyz instead. transparent users.

alternative to bitmap index in postgresql -

i have table hundreds of millions rows schema below. tabe aa { id integer primay key, prop0 boolean not null, prop1 boolean not null, prop2 smallint not null, ... } the each "property" field (prop0, prop1, ...) has small number of distinct values. , query find "id" given conditions of properties fields. think bitmap index best query. postgresql seems not support bitmap index. i tried b-tree index on each field these indexes not used according query explain. is there alternative way this? (i'm using postgresql 9) your real problem bad schema design, not index. properties should placed in different table , current table should link table using many many relation. the bit datatype might of use, check manual .

Working with yahoo messenger using c# application -

hi i want know how can working using c# application yahoo messenger i'm going create application following specification : 1- application standalone application , work on independent computer 2- application should listen yahoo messenger , when someone's status change online send pm him/her. want find way programming mean programming method or psudocode think there lot of samples java need c#. i know of no existing ymsg protocol implementation in c#. if you're determined application in c# best bet pick 1 of java implementations , try port it. 1 other option http://ycoderscookbook.com/ . site has number of sample programs may point in right direction. ycc trainer in vb.net converted c# using .net reflector. your description sounds eerily spam bot. if intention keep in mind that: yahoo's terms of service prohibit this* im spamming blocked using whitelist/blacklist *then again prohibit reverse engineering of protocol , unauthorized use thirdparty p...

How do I pass information my a controller to a view in PHP (no framework)? -

using php, if have model (a class) various queries, whatever need, , in controller, use mymodel = new customermodel(); , later in controller, call mymyodel in controller (i know looks codeigniter not using framework) to: $data['query'] = mymodel.orderbylastname(); how pass $data['query'] view, separate .php page? i don't wan echo controller. also, hoping design, way explained makes sense. or wasting time model class? typically, you'd instantiate view object: $view = new view(); pass info needs(): $view->set($name1, $value1); $view->set($name2, $value2); ... then invoke view's renderer: $view->render();

C++ library to discover sql database schema for multiple vendors? -

just wondering if knows of c++ library provides single interface querying database schema (tables, fields, field types), , variety of vendors? know dtl degree, although haven't dug details of how it, or if makes info available external itself. *odbc fine, , i've considered it, i'd see if there other libraries might encompass odbc, native drivers (to access info odbc may not provide?), obscure databases may not provide odbc drivers, etc. that can done odbc .

.net - Why doesn't Windows Phone 7 fully support the C# specification? -

why doesn't windows phone 7 support c# specification when language available c#? okay, can understand lack of "dynamic" support, why isn't contra-covariance supported? why aren't third-party libraries familiar , use in server-desktop projects not compatible phone 7? what's sense in having intermediate il code if still end here? bear in mind it's running on compact framework clr - doesn't have features of desktop clr. edit: after bit of trawling, i've found generic variance isn't supported in compact framework (or @ least wasn't in 2005, , suspect hasn't been implemented since there's been little use until recently): no support variance modifiers. though variance/co-variance forms part of overall ecma spec generics, , implemented full .net clr, not used in base class library or c# , vb. okay, doesn't "fully support" c# 4 (the absolutely latest release), know of c# 3 language features aren't s...

asp.net - Forms Authentication Ignoring Default Document -

i have spent day , half trying resolve issue. bascially have asp.net website forms authentication on iis7 using framework 4.0. the authorization stuff seems working every scenario exception of hitting no document specifed (should resolve default doc). for example (please don't harsh on site still developed ;) ), http://www.rewardroster.com/default.aspx works perfectly, page should allow anon access specified in web.config. but if hit www.rewardroster.com directly redirects login page return url set "/" or login.aspx?returnurl=%2f some things have tried: 1) set authentication none , default document worked thats not issue. 2) added defaultdocument attribute web.config 3) deleted entries in default document list in iis except default.aspx 4) added machinekey entry in config 5) toggled integrated classic pipeline in iis here what's in config: <authentication mode="forms"> <forms name="appnameauth" loginurl=...

objective c - iphone app communication without using webservices -

i want send text plus image 1 iphone application other iphone app restriction should not use web server in between communication,is there way fulfill ? details: there 2 independent devices , far enough out of network. requirement 1 app adds text image , sends iphone can @ long distance , , app installed in iphone read info , image itself. actually there solution meets needs — , fits bbums answer: create http-server on iphone, using cocoahttpserver. ask webservice whatismyip.com public ip. iphone can connected worldwide. ur wifi-network not forwarding port iphone. ash. , if: gets difficult. how publish ip 1 phone other? hmmm... — got it: exchange information in centralized space! in web! ... wait — webserver. you see: without kind of server in web users need exchange ip manually , have full admin power , knowledge local network. imho bbums answer way go. ps: working http server running on iphones. in local network works great, bonjour. , can use them on d...

xml - How do I extract a value from SSIS package file using PowerShell? -

sql server integration services packages stored xml files dtsx extension. need able extract build numbers powershell. relevant part @ top of file looks like- <?xml version="1.0"?> <dts:executable xmlns:dts="www.microsoft.com/sqlserver/dts"> <dts:executabletype="msdts.package.1"> <dts:property dts:name="packageformatversion">2</dts:property> <dts:property dts:name="versionmajor">1</dts:property> <dts:property dts:name="versionminor">0</dts:property> <dts:property dts:name="versionbuild">265</dts:property> i need extract versionbuild number, dts namespace confusing me. after get-content, how can @ value? as part of sql server powershell extensions codeplex project there ssis module. can this: import-module ssis $package = get-ispackage -path "c:\program files\microsoft sql server\100\dts\packages\sqlpsx1.dtsx" $packa...

programming languages - Anybody know how to get ahold of SAM76 source code for Linux? -

resistors.org site , foxthompson.net download links stale/broken. http://www.resistors.org/index.php/the_sam76_programming_language every other link i've been able track down on 'net (mostly in old newsgroup posts) broken. e-mails respective webmasters bounced. i have morbid curiosity arcane programming languages, , sam76 sounded interesting , mess around with. there quite few lisp folks lurking on site, figured might have lead... heard sam76 had redimentary functional programming ideas. extra credit: link track down copy of sam76 manual! wayback has copy of s76.exe dos , windows http://web.archive.org/web/20070505122813/http://www.resistors.org/index.php/the_sam76_programming_language http://wikivisually.com/wiki/sam76 http://encycl.opentopia.com/term/sam76 http://encycl.opentopia.com/term/algorithms_in_sam76 ======================= f r e e w r e ======================= user-supported software if using prog...

jquery multiple callbacks to keep animation order -

its 2nd day using im sorry if theres obvious error here. im trying have 3 functions execute 1 after other on load event, 3rd callback function cancels out 2nd. allowed 3? if no whats way around it. $j(window).ready(function() { $j("#content").animate({ marginleft: parseint($j("#content").css('marginleft'),10) == 0 ? $j("#content").outerwidth() : 0 },function(){ $j(".headerimg").slidetoggle(900); },function(){ $j(".headertitleimg").slidedown(100);} ); }); thank you. you calling animate method 2 callback functions: animate(properties, callback, callback) . documentation specifies use of 1 callback function, it's possible allows more. hoever, if does, second callback called when first returns, won't wait animation first started. the solution make second function callback first functions slidetoggle call: $j(window).ready(function() { $j(...

bash - How can I grep complex strings in variables? -

i trying grep small string in larger string. both strings being stored variables , here code example: #!/bin/bash long_str=$(man man) shrt_str="guide" if grep -q $shrt_str $long_str ; echo "found it!" fi i don't think variable expansion working way expect to. have tried [ ] , [[ ]] , quoting variables , piping output /dev/null no matter won't work. does have ideas? echo "$long_str" | grep -q "$shrt_str" if [ $? -eq 0 ];then echo "found" fi or echo "$long_str" | grep -q "$shrt_str" && echo "found" || echo "not found" but since using bash shell, use shell internals. no need call external commands shrt_str="guide" case "$long_str" in *"$shrt_str"* ) echo "found";; * ) echo "not found";; esac

What is the difference between Spring's GA, RC and M2 releases? -

spring's 3.0 version ga release, before have launched 3.0 rc1 , rc2 version also, there spring 3.0 m2 version. what's difference between ga, rc, m versions? ga = general availability (a release); should stable , feature complete rc = release candidate; feature complete , should pretty stable - problems should relatively rare , minor, worth reporting try them fixed release. m = milestone build - not feature complete; should vaguely stable (i.e. it's more nightly snapshot) may still have problems.

sql server 2005 - Error: Retrieving the file name for a component failed with error code 0x03B98F74 -

i have simple ssis activex script task returning above error when executing: i've cut code down empty function: function main end function and have ensured entrymethod property of component main any suggestions? i came across same error , found connection in activex script referencing dsn name didn't exist. added dsn through control panel -> administrative tools -> data sources (odbc) , issue resolved.

jQuery UI datepicker & dialog sends data to # when a date is selected -

jquery ui datepicker y dialog when date selcted in datepicker in dialog, data sent #. when date selected, text should selected , data should not sent until submit clicked. is there solution this? look @ this. may same reason , solution can you: jquery ui datepicker ie reload or jumps top of page

css: overriding input[type="text"] -

css looks like: input[type="text"] { width: 200px; } .small { width: 50px; } i have text fields i'd smaller. i've tried few different things, can't figure out how specify input field with, say, width 50. textbox rendered with: <%= html.textbox("order","",new { @class="small", size = 5 } ) %> size attribute ignored, , .small doesn't override input. write more specific selector . e.g. input[type="text"].foo { width: 50px; }

Data Binding with Silverlight accordion Control -

i have silverlight accordion control in childwindow , customized following way <style x:key=itemstyle targettype=accordionitem> <setter porperty=headertemplate> <datatemplate> <textblock x:name=_headertext/> </datatemplate> </setter> </style> <accordion style"{staticresource itemstyle}"> <accordion.contenttemplate> <datatemplate> <stackpanel> <checkbox/> <textblock x:name=_contenttext/> </datatemplate> <accordion.contenttemplate> </accordion> now have method in chilwindow.xaml public void loaditems(observablecolection<groups> gp) {} this method called mainpage , passes gp value groups class public properties , observable collections.for example public class groups { public string firstname{get, set;} public observablecollection<details> details {get, set;} public groups() { this.details=...

android - Widget Implementation Advice Needed -

i'm new android , want write widget contains (about)100 columns, each column contains various amount of child views (will determined @ run time via service call). users can scroll horizontally , vertically (similar behavior gridview horizontal scrolling). child views customized widgets imagebutton , used load images , data via service call when exposed on screen. i have implemented 2d scroll view enables users scroll vertically , horizontally. i'm using horizontal linear layout container columns. however, i'm having trouble designing columns. i've thought implementing in following ways: use vertical linear layout column , subclass of imagebutton child view. challenging part how load data , image when button become visible , how dereference them once scrolled off screen. know android doesn't have method tell whether widget on/off screen (like onexpose( ) method), i'm not sure if it's possible (easily). use sort adapterview column. listview close...

system - Erlang port driver communicating with C program -

if want erlang process connect c shared lib use erlang linked in port driver. as want c program stores data structures respond erlang calls, must use global variables. is there problem? thanks! you running c-programme in own process , talking on pipe - erlang can't see memory space of c programme , doesn't care how write it. erlang vm not dependant on port driver - that's architecture for.

web applications - Finding paths for packaged non-java files at runtime -

so might stupid question but... i want package specific wsdl file in ejb project within eclipse. best way refer file in code? i use relative path current directory starts off in /bin directory of jboss installation. seems there should way refer file in relation project file structure. any ideas? getclass().getresource(string path) uses relative path locate classpath resource. returns java.net.url . alternatively, can use getresourceasstream(..) obtain inputstream resource.

python: convert UUID to a string which is a C unsigned char[16] initializer -

(in case you're curious motivation: used in scons build generate c file containing guid) i found question generating guid in python . don't know programming python. me convert string of form "{0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**}" where **'s filled in guid bytes in 2-digit hex form? def getinitializer(someuuid): hexbytelist = [??? b in someuuid.bytes] return '{'+(', '.join(hexbytelist))+'}' i'm not sure use "???" above. hex(ord(b)) ...