Posts

Showing posts from January, 2012

WPF MVVM - create model from database -

i heard suitabale solution situation. i use in wpf app caliburn.micro framework. need have acess sql compact db. on db access use linq sql. for example in view have combobox control or listbox control. need load items of these controls db. so create simple class on access db. [export(typeof(idbmanager))] public partial class dbmanager : idbmanager { public ilist<spirit_users> loadspiritusers() { var result = u in _dc.spirit_users orderby u.nick select u; return result.tolist(); } } i inject class mef view model class. on use method class on db access in view model class on load items combobox. [export(typeof(ilogonviewmodel))] public class logonviewmodel : screen, ilogonviewmodel, ipartimportssatisfiednotification { [import] internal idbmanager dbmanager { get; set; } //this property bind on listbox or combobox public bindablecollection<spirit_users> spiritusers { { return _spiritusers; } ...

cakephp - Cake Bake error -

Image
i trying use cakes baking console , when use cake bake model all i getting following error attendance table structure create table if not exists `mydb`.`attendences` ( `id` int(11) unsigned not null auto_increment , `datetime` datetime null , primary key (`id`) ) engine = innodb; rather baking @ once, table-by-table , model-controller-view separately. way you'll able pin down error. have created fixtures correctly? see http://book.cakephp.org/view/360/creating-fixtures , check syntax correct, particularly in array definitions.

winforms - Bool property not serializing when set to false in inherited form -

i have inherited form has bool property toggles controls on , off , should visible in designer. problem property value seems serialized designer code when it's set true. if it's set false nothing gets generated, because it's default value. i've tinkered around designerserializationvisibility , defaultvalueattribute attributes doesn't seem ... i don't know if may help, i've had similar question answered. if go link below can see thread. autosize set false in designer

I don't understand some old C array concatenation -

i don't understand syntax in old c program, , not set test code see does. part confused concatenation array. didn't think c handle auto-typecasting that, or making difficult in head being friday afternoon... char wrkbuf[1024]; int r; //some other code //below, vrec 4 byte struct memcpy( &vrec, wrkbuf + r, 4 ); any idea happen here? wrkbuf become when concatenate or add int it? wrkbuf + r same &wrkbuf[r] essentially wrkbuf when used in expression wrkbuf + 4 "decays" pointer first element. add r it, advances pointer r elements. i.e. there's no concatenation going on here, it's doing pointer arithmetic. the memcpy( &vrec, wrkbuf + r, 4 ); copies 4 bytes wrkbuf array , starting @ r th element memory space of vrec

php - Impact of Share Button on Web Page Performance -

on few websites maintain, noticed adding share button addthis page varyingly slows down page loading, significantly. what explanation , can done keep share buttons while not incurring page loading performance penalty this? add script call bottom of page, that's do, right on top of </body> . ... html ... <!-- addthis button begin --> <div class="addthis_toolbox addthis_default_style "> <a href="http://www.addthis.com/bookmark.php?v=250&amp;username=xa-4d4c6a9028bcda9b" class="addthis_button_compact">share</a> <span class="addthis_separator">|</span> <a class="addthis_button_preferred_1"></a> <a class="addthis_button_preferred_2"></a> <a class="addthis_button_preferred_3"></a> <a class="addthis_button_preferred_4"></a> </div> <!-- addthis button end --> ... html ... <script typ...

codeigniter - auth tank 1.0.7 -

recently went 1.0.8 new codeigniter 2.0 release. still use codeigniter 1.7.3 , finding auth tank 1.0.8 doesnt work it. tried looking version history on auth tanks website couldn't . 1 know can auth tank 1.0.7? you should able access svn repository here , using svn client (tortoise svn or whatever) go in revisions , versions 1.0.7. here repo: https://tankauth.svn.sourceforge.net/svnroot/tankauth/ - although, issues having 1.0.8 anyway? error messages getting? the issue fact ci 2 introduced changes how controllers , models extended. in ci 1.7.2 / 1.7.3 controllers , models extended controller , model respetively, in ci 2 controllers extend ci_controller , models extend ci_model. maybe go through code , make sure tank auth extending latter , not ci_ prefixed controllers , models. also in ci 2 models , controllers call parent class via parent::__construct(), in ci 1.7.x contructor functions called parent class this: parent::controller() , parent::model(). i think ...

How to define an extern, C struct returning function in C++ using MSVC? -

the following source file not compile msvc compiler (v15.00.30729.01): /* stest.c */ #ifdef __cplusplus extern "c" { #endif struct test; /* nb: may extern when imported module. */ struct test make_test(int x); struct test { int x; }; struct test make_test(int x) { struct test r; r.x = x; return r; } #ifdef __cplusplus } #endif compiling cl /c /tpstest.c produces following error: stest.c(8) : error c2526: 'make_test' : c linkage function cannot return c++ class 'test' stest.c(6) : see declaration of 'test' compiling without /tp (which tells cl treat file c++) works fine. file compiles fine in digitalmars c , gcc (from mingw) in both c , c++ modes. used -ansi -pedantic -wall gcc , had no complaints. for reasons go below, need compile file c++ msvc (not others), functions being compiled c. in essence, want normal c compiler... except 6 lines. there switch or attribute or can add allow work? the code in qu...

c++ - insertvalue function in stack class is not calling when pointing by smartpointer class? please expain -

template< class type > class cstack { type *m_array; int m_top; int m_size; public:cstack(); cstack(const type&); cstack(const cstack<type> &); bool is_full(); bool is_empty(); void insertvalue(const type&); void remeovevalue(); ~cstack(); }; template< class type > class smartpointer { cstack<type> *sptr; public: smartpointer(); smartpointer(const type&); type* operator->(); type& operator*(); }; int main() { smartpointer<int> sptr(1); sptr->insertvalue(2);//its not calling insertvalue } } an int not have method called insertvalue. may-be wanted use smartpointer<cstack<int> > ?

winforms - c# Listview displaying in lines -

Image
basically have listview control has coloums (displayed in detail mode) add items want displayed, each under 1 colomn (like invoice) displays them under first instead. i've been adding items below guess wrong way every other way tried not working. can see result in screenshot. lstvline.items.add(lineitem, lstvline.items.count); lstvline.items.add(itemname,lstvline.items.count); you need create subitems each of additional fields: listviewitem item = new listviewitem ("something"); item.subitems.add ("brand info"); item.subitems.add ("type info"); lstvline.items.add(item);

calling managed c# functions from unmanaged c++ -

how call managed c# functions unmanaged c++ or use project of mine allows c# create unmanaged exports. can consumed if written in native language.

multithreading - wait for other thread to finish in objective c -

i using mgtwitterengine fetch tweets twitter. uses asynchrounous paradigm fetch tweetsin thread. returns fetched results main thread. because have processing todo after tweets fetched, introduce thread prevent locking ui thread. lik way: ui thread starts new thread x. thread x starts asynchronous fetching of tweets mgtengine, , waits finish. when mgtwitterengine returns, thread x processes tweets, , notifies ui thread ready. my question is: how set thread x wait till mgtwitterengine reade? there little excuses not use multithreading blocks now. quicker develop nsoperations, synchronisation simpler, jumping threads (e.g. grabbing ui thread) simpler , in own experience performance better. in case, create block, spawn new thread fire async fetch (possibly spawning async fetch each one- makes cancelations easier) put 2 sync blocks in queue fire after fetches done processing , ui update. here tut: http://www.fieryrobot.com/blog/2010/06/27/a-simple-job-queue-with-grand-ce...

c - getchar() and reading line by line -

for 1 of exercises, we're required read line line , outputting using getchar , printf. i'm following k&r , 1 of examples shows using getchar , putchar. read, getchar() reads 1 char @ time until eof. want read 1 char @ time until end of line store whatever written char variable. if input hello, world!, store in variable well. i've tried use strstr , strcat no sucess. while ((c = getchar()) != eof) { printf ("%c", c); } return 0; you need more 1 char store line. use e.g. array of chars, so: #define max_line 256 char line[max_line]; int line_length = 0; //loop until getchar() returns eof //check don't exceed line array , - 1 make room //for nul terminator while ((c = getchar()) != eof && line_length < max_line - 1) { line[line_length] = c; line_length++; //the above 2 lines combined more idiomatically as: // line[line_length++] = c; } //terminate array, can used string line[line_length] = 0; printf("%s\n...

design patterns - How to do dependency injection python-way? -

i've been reading lot python-way lately question is how dependency injection python-way? i talking usual scenarios when, example, service needs access userservice authorization checks. it depends on situation. example, if use dependency injection testing purposes -- can mock out -- can forgo injection altogether: can instead mock out module or class otherwise inject: subprocess.popen = some_mock_popen result = subprocess.call(...) assert some_mock_popen.result == result subprocess.call() call subprocess.popen() , , can mock out without having inject dependency in special way. can replace subprocess.popen directly. (this example; in real life in more robust way.) if use dependency injection more complex situations, or when mocking whole modules or classes isn't appropriate (because, example, want mock out 1 particular call) using class attributes or module globals dependencies usual choice. example, considering my_subprocess.py : from subprocess im...

c++ - event handling in com port -

i wrote c++ code communicate usb gsm modem using com ports. want informed when modem pulled out or disconnected somehow. can using event handling or other way? if answer yes i'll grateful if tell me way. in advance :). thanks arefin yes. usb standard quite definite fact unplugging of devices allowed , must managed os. since haven't told os, can't point precise function. in general, you'd @ device management functions.

objective c - best way to initialize an array in terms of memory management -

please see code below - (void) viewdidload() { nsmutablearray *temparray = [[nsmutablearray alloc]init]; [self setimagesarray:temparray]; [temparray release]; [self display]; } -(void) display { //here add objects imagesarray [self.imagesarray addobject:temp]; //temp image } now wanna know if release imagesarray in dealloc() cause memory leak , above way right initialize array declared property. thanx in advance. as understand doing right, relasing image array in dealloc.

debugging - How to stop Javascript runtime error notifications in Visual Studio -

i used plugin tries value many methods, because of them not implemented in browsers. code working everywhere , performs fine. the problem ie not support javascript function called. when non-implemented browser function called, see same window every time: microsoft jscript runtime error: object doesn't support property or method" i want stop error showing in visual studio. there way configure visual studio never break on errors , not tell me them? go internet options in ie , under advanced tab can select disable script debugging both ie , other, should stop breaking on errors.

artificial intelligence - Designing a twenty questions algorithm -

i interested in writing twenty questions algorithm similar akinator and, lesser extent, 20q.net uses. latter seems focus more on objects, explicitly telling not think of persons or places. 1 akinator more general, allowing think of literally anything, including abstractions such "my brother". the problem don't know algorithm these sites use, read seem using probabilistic approach in questions given fitness based on how many times have lead correct guesses. so question presents several techniques, rather vaguely, , interested in more details. so, accurate , efficient algorithm playing twenty questions? i interested in details regarding: what question ask next. how make best guess @ end of 20 questions. how insert new object , new question database. how query (1, 2) , update (3) database efficiently. i realize may not easy , i'm not asking code or 2000 words presentation. few sentences each operation , underlying data structures should enough me ...

VB.Net: Class Inheritance make one class another -

i have organization has clients , students, every student begins client. if have client class , student class inherits client. how make client student? it sounds problem involves persistence more inheritance. if have client, presumably persistent data stored in client table. when client becomes student, create record in student table containing student information , id of client record. client object loaded client table, while student object pull data both client , student tables. relating data means client info never duplicated, while making simple retrieve either client info, or student--including client--info.

c# - Focus on Canvas overlapping the listbox in WP7 -

i have situation here. have page containing listbox. listbox populated items if able fetch data web service. when user doesn't have network connectivity on phone or webservice doesn't respond ok status, want show user pop-up option retry or select ok stay on same page (though sounds dumb). used canvas: <canvas name="nonetwork" height="150" width="280" horizontalalignment="center" verticalalignment="center" background="dodgerblue" visibility="collapsed" margin="111,160,92,160" > <textblock verticalalignment="top" height="120" width="280" text="no network availabe" textalignment="center" textwrapping="wrap" foreground="white" fontsize="28" /> <button margin="30, 80" height="60" width="100" content="ok" fontsize="18" click="ok_click"/...

visual studio 2010 - Startup params for Silverlight 4 app -

we moving our sl3 app sl4. first step open in vs2010; converted w/o problem. however, parameters specified start page not passed along. is, if specify ourstartpage.aspx?slam=dunk&glass=sun in app.xaml.cs, application_startup(), e.initparams empty. how fix this? advice.... (note same startup string worked in vs2008.) update: urrk. works, doesn't seem right: // settings passed in page if (e.initparams.count > 0 ) { applicationstartupcontext.instance.fill(e.initparams); } else { applicationstartupcontext.instance.fill(htmlpage.document.querystring); } the reason works have params in querystring , not initparams might think. initparams covers tag in silverlight object in html actually link better example how :)

java - Problem with images and JSP -

i not able see images in jsp page. error resource interpreted image transferred mime type text/html. what mean? solution? it means client requested thought image , received server claimed html document. i suspect that: you have wrong urls images and the servers 404 not found error page being sent 200 ok status code.

Why isn't an exception thrown when the right .NET framework version is not present? -

we have .net application targets .net 3.5. our clients run shared drive (very infrequently) in order have central config file location. we have noticed if workstation accesses shared drive , runs program, not have .net 3.5 installed, nothing happens, no error, no exception, no log entry, doesn't launch. why there no error message shown in windows clr? is there can put @ beginning of code ensure proper error message displayed? it not option run installer check prereqs, installing in 1 central location. thanks. ideally, wouldn't have have wrapper query .net version, seems program failing launch, , windows should reporting somewhere. can't believe silently fail. try app.config; <configuration> <startup> <supportedruntime version="v3.5" /> </startup> </configuration> i nice little dialog, so; --------------------------- moreverfoo.exe - .net framework initialization error ------------...

objective c - Gcc not including Object.h -

i starting on doing objective-c gcc (so far used xcode). #include <objc/object.h> @interface integer : object { int integer; } - (int) integer; -(id) integer: (int) _integer; @end #import "integer.h" @implementation integer - (int) integer { return integer; } - (id) integer: (int) _integer { integer = _integer; } @end and once try compile stuff this: main.m: in function ‘main’: main.m:8: warning: ‘integer’ may not respond ‘+new’ main.m:8: warning: (messages without matching method signature main.m:8: warning: assumed return ‘id’ , accept main.m:8: warning: ‘...’ arguments.) main.m:8: warning: ‘integer’ may not respond ‘+new’ seems me inclusion of object.h did not quite work. searched thee includes object.h , got this: find /usr/include/ -name object.h /usr/include//objc/object.h also gcc output hints compiler is searching in path. #include "..." search starts here: #include ...

encryption - BitShifting with BigIntegers in Java -

i implementing des encryption in java use of bigintegers. i left shifting binary keys java bigintegers doing biginteger.leftshift(int n) method. key of n (kn) dependent on result of shift of kn-1. problem getting printing out results after each key generated , shifting not expected out put. key split in 2 cn , dn (left , right respectively). i attempting this: "to left shift, move each bit 1 place left, except first bit, cycled end of block. " it seems tack on o's on end depending on shift. not sure how go correcting this. results: c0: 11110101010100110011000011110 d0: 11110001111001100110101010100 c1: 111101010101001100110000111100 d1: 111100011110011001101010101000 c2: 11110101010100110011000011110000 d2: 11110001111001100110101010100000 c3: 1111010101010011001100001111000000 d3: 1111000111100110011010101010000000 c4: 111101010101001100110000111100000000 d4: 111100011110011001101010101000000000 c5: 111101010101001100110000111100000000...

php - Is this ajax behavior normal, security-wise -

it seems i'm failing understand ajax security , it's not helping keep getting contradicting answers questions. did experiment. i have js code on site1.com located @ http://site1.com/script.js . on server side, makes entry database doesn't return output. when call function site1.com, see entry logged in database expected. function enterdb(){ $.ajax({ async: false, url: 'http://site1.com/test?format=json', type: 'post', data: { input: '1' }, success: function(resp) { alert(resp); } }); } i copied same js js file of othersite.com , located @ http://othersite.com/script.js see myself if log database. did not because don't want people playing ajax urls other external scripts. contradicts of answers read in previous qusetions this answers matches result got cross domain banned because of same origin policy. but same answer said your javascript making xhr , spoofing one, same , impossible ...

jQuery unbind('hover') does not work -

this question has answer here: how unbind “hover” in jquery? 8 answers my unbind not work. $("img.hoverable").hover(changeimage, changeback); $("a img.hoverable").unbind('hover'); the html this <img class="hoverable" src="something.jpg"/> <a href="#"><img class="hoverable" src="something.jpg"/></a> when hover on second html, changeimage still fired. i not sure if using correctly, can please advise? try $("img.hoverable").unbind('mouseenter mouseleave'); the .hover() method binds handlers both mouseenter , mouseleave events. inorder unbind have unbind mouseenter , mouseleave.

java - Design decision: extending an interface vs. new interface -

hallo, i have little design decision today: there existing interface, called 'targetsystem' have 1 method 'getname()'. there no other common information these target systems. have new kind of target systems need authentication. i have know whether target system needs authentication or not (the frontend have show password dialog those). if needs authentication, have set username , password. my design decision: should extend existing interface methods 'needsauthentication' , 'setusernameandpassword' or creating new interface extending old 1 method 'setusernameandpassword', getting authentication need instanceof. important: there no need downwards compatible or other reason not touch old interface! discussing co-worker, way nice one: creating interfaces names 'objectwithfeaturex', 'objectwithfeaturey' or creating methods 'hasfeaturex', 'hasfeaturey'. i don't agree with peter. sometimes, instan...

sql - Are relationship tables really needed? -

relationship tables contain 2 columns: idtable1 , , idtable2 . only thing seems change between relationship tables names of 2 columns, , table name. would better if create 1 table relationships , in table place 3 columns: table_name , idtable1 , idtable2 , , use table relationships? is good/acceptable solution in web/desktop application development? downside of this? note: thank feedback. appreciate it. but, think taking bit far... every solution works until 1 point. data storage simple text file till point, excel better, ms access, sql server, than... honest, haven't seen argument states why solution bad small projects (with db size of few gb). bad idea. how enforce foreign keys if idtable1 contain id s table @ all? to achieve acceptable performance on joins without load of unnecessary io bring in unrelated rows need composite index leading column table_name ends partitioning table sections anyway. obviously pseudo partitioning going on still w...

jquery - How do I delay html text from appearing until background image sprite is loaded? -

here's sample code want control using jquery (white button bg on black page bg): <ul class="buttons"> <li class="button-displays"><a href="/products/">products , services company</a></li> <li class="button-packaging"><a href="/packaging/">successful packaging services company</a></li> <li class="button-tools"><a href="/tools/">data, mail , print tools company</li> </ul> in css file, have following: .buttons li { background-image: url(images/sprite.png); height:126px; width:293px; float:left; margin:0 0 0 9px; } .button-displays { background-position: 0 125px; } .button-packaging { background-position: 0 250px; } .button-tools { background-position: 0 375px; } i have styled these list items clickable buttons background sprite helping fill out background of buttons. my client d...

osx - Throttling respawn - Error message in Console.app -

i'm getting error message every 10 seconds. 2011-02-09 05.54.37 com.apple.launchd.peruser.501[153] (com.mysql.mysqld) throttling respawn: start in 10 seconds i'm running os x 10.6.6. anyone knows problem may , how solve it? this situation that's been around in unices donkey's years. program exiting invoked, leading restarted on , on launchd . launchd has noticed , stopped respawning program. standard advice on goes many years, too: find out why daemon process exiting rather running, , fix cause of that. (it's daemon misconfiguration of kind.) yes, technically, in mac os 10 speak "agent" rather "daemon", doesn't change either nature of problem or have fix it.

seo - dynamic text in <h1> tag -

what impact on seo of changing text of <h1> dynamically on server side each time web page loads? i'm not talking changing whole text, part of it, example if header contains fixed text (with keywords of course), , contains current date or time/the current number of logged on users/the count of items current in stock/whatever. how affect ranking? bad? doesn't make difference? thanks. i don't think element need should h1, since semantically, h1 important heading on page can shouldn't contain isn't of crucial importance number of logged in users o time. personally, use h1 important heading contains important keywords. otherwise, can put wanted h1 , perhaps paragraph , put them in div altogether such purpose paragraph contains content irrelevant page , still harness value of h1 , content want in virtually same spot.

php - Javascript confirm box redirect to dynamic URL -

this trying do, not work. solutions? window.location = "delete.php?case=<?php echo $case; ?>" to handle redirect when confirming, need sure use right quotes @ right time , in case of link, make sure cancel default link behaviour: inline: <a href="#" onclick="if (confirm('delete?')) window.location='delete.php?case=<?php echo $case; ?>'; return false">delete using script</a> inline using plain js function: function deleteit(id) { if (confirm('delete?')) { window.location='delete.php?case='+id; } return false; } using <a href="#" onclick="return deleteit('<?php echo $case; ?>')">delete using script</a> unobtrusively using plain js function: window.onload=function() { document.getelementbyid("<?php echo $case; ?>").onclick=function() { if (confirm('delete?')) { window....

iphone - iphonesdk nsmutable array object issue -

i have mutable array named namearray contains 7-8 objects. i wanted check if contains 0 object display alert view. what should write check namearray contains 0 object. if ([namearray count] == 0) { // show alertview }

c - GtkComboBox related qusestion -

how set gtkcombobox default selectio? how adjust x, y location of drop down menu of gtkcombobox? want display drop down menu @ lower edge of gtkcomobox. also want set text color of selected text in combo box white. thank, pp. gtk_combo_box_set_active function use set default selection. here's example: gtk_combo_box_set_active(gtk_combo_box(combo), index); where index integer value corresponds index number of item want default. value entirely dependent on data within gtktreemodel have combo box using. as other questions, don't know, suggest install dev-help, or scour gtk documentation @ gtk website.

Intercept CKEditor keystroke -

can intercept keystroke in ckeditor (the tab key) , replace default behavior? want tab key insert div margin. this.editorinstance.on( 'tab', function(evt){ evt.editor.inserthtml('span style="margin-left: 40px;">&nbsp;</span>'); evt.cancel(); return false; })

hibernate - threw an unexpected exception: java.lang.reflect.InvocationTargetException -

i working on gwt-hibernate application, application works on integrated gwt environment , on external server tomcat. need deploy application on jboss v 6.0. able deploy application on jboss , able run until on point of execution. @ particular button click application threw unexpected exception: java.lang.reflect.invocationtargetexception normally "java.lang.reflect.invocationtargetexception" occurs when java compiler finds 2 different classes same name in 2 different packages. when importing both classes @ time , when trying create object of class throws " java.lang.reflect.invocationtargetexception " exception. now not able figure out compiler finds 2 different class! there method available can know exact location (i.e physical path) finds 2 different path, can remove bad one. any appreciated. thanking you, regards, edit : error [org.apache.catalina.core.containerbase.[jboss.web].[localhost].[/myproj]] (http-127.0.0.1-8080-4) exception while dispa...

arrays - PHP unreference -

lets have code: $val = 1; $arr = array(); $arr['val'] =& $val; $val = 2; echo $arr['val']; this print out 2, because $val passed $arr reference. my question : if passed value array reference, there way remove reference later on, making simple copied value ? make clearer, this: $val = 1; $arr = array(); $arr['val'] =& $val; $arr['val'] = clone $arr['val']; // or better yet: $arr = clone $arr; $val = 2; echo $arr['val']; and should print out 1 (because array cloned, before referenced variable changed). howerver, clone not work arrays, works objects. any ideas? have no clue how this. tried writing recursive copy function, didn't work. you unset index , reassign by-value instead of reference. unset($arr['val']); $arr['val'] = $val;

java - In which DLL is the COM interface iStream defined? -

i'm complete newbie windows , com programming, trying use com4j in order call com object java. com4j generates java interfaces com definitions " often found in .ocx, .dll, .exe, and/or .tlb files " . easy me locate .ocx file of target com object, have no clue regarding standard interface istream. microsoft's documentation mentions ole32.dll ( c:\windows\windows32\ole32.dll ?) , neither com4j generator nor oleviewer succeed in opening file. any hints? it looks defined in comsvcs.dll .

<Javascript display property -

in form have textbox , calendr along other controls <asp:textbox id="textbox2" runat="server" onfocus="calopen()" asp:textbox> <asp:calendar id="calendar1" runat="server" style="display:none;" onselectionchanged="calendar1_selectionchanged"></asp:calendar> <script type="text/javascript"> function calopen() { var cal = document.getelementbyid('<%=calendar1.clientid%>'); cal.style.display='block'; } </script> protected void calendar1_selectionchanged(object sender, eventargs e) { textbox2.text = calendar1.selecteddate.tolongdatestring(); calendar1.visible = false; } protected void imagebutton1_click(object sender, imageclickeventargs e) { calendar1.visible = true; } for first time worked fine, but, 2nd time when click textbox2, is, after selecting date first time. browser throw...

osx - How to- NSAttributedString to CGImageRef -

i'm writing quicklook plugin. well, works. want try make better ;). question. here function returns thumbnail image , i'm using now. qlthumbnailrequestsetimagewithdata( qlthumbnailrequestref thumbnail, cfdataref data, cfdictionaryref properties); ); http://developer.apple.com/mac/library/documentation/userexperience/reference/qlthumbnailrequest_ref/reference/reference.html#//apple_ref/c/func/qlthumbnailrequestsetimagewithdata right i'm creating tiff -> encapsulated nsdata. example // setting cfdataref cgsize thumbnailmaxsize = qlthumbnailrequestgetmaximumsize(thumbnail); nsmutableattributedstring *attributedstring = [[[nsmutableattributedstring alloc] initwithstring:@"dummy" attributes:[nsdictionary dictionarywithobjectsandkeys: [nsfont fontwithname:@"monaco" size:10], nsfon...

iphone - How do I add a reflection to a UILabel. IOS -

(newbie) question here. searched not find specific answer anywhere.... want add reflection (and glow if possible) uilabel. saw apple's reflection project code works uiimage not label. just adding simple clock: - (void)runtimer //starts timer messages runclock every 0.5sec { myticker = [nstimer scheduledtimerwithtimeinterval:0.5 target:self selector:@selector(runclock) userinfo:nil repeats:yes]; } - (void)runclock { nsdateformatter *formatter = [[[nsdateformatter alloc] init] autorelease]; nsdate *date = [nsdate date]; // produce time looks "12:15:00 pm". [formatter settimestyle:nsdateformattermediumstyle]; [clocklabel settext:[formatter stringfromdate:date]]; } i wrote article on how generate reflections of ui element or group of elements. canned technique can dropped project , easy use. source code , article can found @ http:/...

Access and print HTTP request query string parameters via EL in JSP page -

i need pass request parameter 1 jsp jsp page this: <a href="cv.jsp?type=alaacv">alaa</a> however, when try access below, doesn't print anything. <c:set var="selectedcv" value="${type}" scope="request" /> <c:out value="${selectedcv}" /> how caused , how can solve it? you need access ${param} implicit el object referring request parameter map (which map<string, string> ; if need map<string, string[]> multi-valued parameters, use ${paramvalues} instead). <c:set var="selectedcv" value="${param.type}" /> <c:out value="${selectedcv}" /> the ${param.type} resolves request.getparameter("type") . you can below without need <c:set> : <c:out value="${param.type}" /> see also: how access objects in el expression language ${} how can retain html form field values in jsp after submitting form servle...

search - Need help with implementation of the jQuery LiveUpdate routine -

has worked liveupdate function (may bit of misnomer) found on this page ? it's not live search/update function, quick filtering mechanism pre-existing list, based on pattern enter in text field. for easier reference, i'm pasting entire function in here: jquery.fn.liveupdate = function(list){ list = jquery(list); if ( list.length ) { var rows = list.children('li'), cache = rows.map(function(){ return this.innerhtml.tolowercase(); }); .keyup(filter).keyup() .parents('form').submit(function(){ return false; }); } return this; function filter(){ var term = jquery.trim( jquery(this).val().tolowercase() ), scores = []; if ( !term ) { rows.show(); } else { rows.hide(); cache.each(function(i){ var score = this.score(term); if (score > 0) { scores.push([score, i]); } }); jquery.each(scores.sort(function(a, b){return b[0] - a[0];}), f...

wpf controls - How to set the location of a WPF window? -

i have list view in have defined custom cell user control. in custom cell given user hyperlink, showing wpf dialog when user clicks on hyperlink. i want wpf dialog comes above hyperlink.. please let me know how can acheive or how set location of dialog comes above hyperlink. window.left , window.top var location = mytextblock.pointtoscreen(new point(0,0)); window.left = location.x; window.top = location.y-window.height;

android - SQLite FTS3 simulate LIKE somestring% -

i'm writing dictionary app , need usual word suggesting while typing. like somestring% rather slow (~1300ms on ~100k row table) i've turned fts3. problem is, haven't found sane way search beginning of string. i'm performing query select word, offsets(entries) entries word match '"chicken *"'; , parse offsets string in code. are there better options? yes , make sure set index on field word , use word >= 'chicken ' , word < 'chicken z' instead of or match or glob

facebook - Facebooker Rails - fb_login_button can't set perms -

hey all, im using facebooker gem connect facebook. working fine except fact cant set perms want user allow. although pass offline_access permission, when popup opens, show basic info permissions. code view <%= fb_connect_javascript_tag %> <%= init_fb_connect "xfbml"%> <%= fb_login_button("window.location = 'some_url';", :perms => "offline_access")%> generates <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/featureloader.js.php" type="text/javascript"></script> <script type="text/javascript"> event.observe(window,'load', function() { fb_requirefeatures(["xfbml"], function() { fb.init('myapikey','/xd_receiver.html', {}); }); }); </script> <fb:login-button onlogin="window.location = 'http://localhost:3000/users/show';" permissions=...

Is "sysServices" snmp-writable in netsnmp? -

the man page on snmpd.conf says syslocation/contact/name snmp-writable, whereas sysdesc/objectid not snmp-writable. how sysservices? thank you! if take @ snmpv2 mib file, states sysservices read-only.

javascript - $fn.insertAfter() and $fn.after() Jquery -

i understand $fn.insertafter() used insert element after element supplied argument. how's $fn.after() different it? $.fn.after() help inserts element after target element, on call it. $('div').after('<div>new div</div>'); whereas, $.fn.insertafter inserts target element after node specify: $('<div>new div</div>').insertafter($('#someid')); the latter prefered, because keep reference newly created element , can chain more methods on it. instance: $('<div>new div</div>') .insertafter($('#someid')) .attr('foo', 'bar') .css({ 'background-color': 'red' }); is possible. cannot .after() help . same thing .append() help / .appendto() help , .insertbefore() help / .before() help

c# - Programmatically generate Visual Studio Solution -

i want write wizard in .net programmatically generates visual studio solution projects. have xml file details of files need included in project respective paths fetch them , list of project names. there way can achieve this well visual studio sdk path go. there methods can create files , think projects based on project templates. instance can create new "asp.net mvc" project or class library. create own template. i quite sure can inside vs. otherwise, there nothing wrong generate project , sln files generating xml files, thats 1 of things plain xml in end. need generate projectd guids, think simple , totally "legal". good progress!

VBScript for creating local account and adding to admin group used to work prior to logout / login to test newly created account: -

set objshell = createobject("wscript.shell") set objenv = objshell.environment("process") strcomputer = objenv("computername") struser = inputbox("enter username new admin account.") strpass = inputbox("enter password new account.") set colaccounts = getobject("winnt://" & strcomputer & ",computer") set objuser = colaccounts.create("user", struser) objuser.setpassword strpass const ads_uf_dont_expire_passwd = &h10000 objpasswordexpirationflag = ads_uf_dont_expire_passwd objuser.put "userflags", objpasswordexpirationflag objuser.setinfo set group = getobject("winnt://" & strcomputer & "/administrators,group") group.add(objuser.adspath) sigh. simple matter of "run administrator".

sql server 2005 - Simple SQL Failover Plan? Log shipping? Mirroring? -

i have physical prod db server (sql05) , vm db server. idea if physical machine goes down, repoint our router (via nat) vm machine. thinking of using log shipping keep vm db current. is correct way it? should looking @ way, mirroring perhaps? we vm db in usable state @ times (so think precludes mirroring) any (good) suggestions requested! :) why wouldn't use mirroring ?

java - how to manage formatting of text when read a save file? -

i have java applet application in use rich text area . write urdu national language of pakistan. managed uni codes. problem is, when write urdu in text area , select font , color each line of when save file using utf-8 encoding , open again shows text formatted choose format of last line. my requirement open file saved. mean each file should have same formatting done before saving. i'm still suffering problem after bounty can 1 help! dated 07-06-2010. see, when format text using font , color, generate rtf/html code right? should try rtf/html of text area formatting can saved in file. basically text file, need code right? check link rtf formatted text saving mechanism. java jtextpane rtf save also check htmleditorkit more info. http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/html/htmleditorkit.html thanks.

save and load value from registry in vb.net -

i have application user select configuration, need write function 1 save configuration when application closed , other load configuration when application loaded, need use registry able me giving me 2 small example how save , load registry. thank jp the "my" class in vb contains need. read data: my.computer.registry.localmachine.getvalue("mykey") to write data: my.computer.registry.localmachine.setvalue("mykey", "myvalue") hope helps.

websphere - Web-based clients vs thick/rich clients? -

my company software solutions provider major telecommunications company. environment ibm websphere-based front-end ibm portal servers talking cluster of back-end websphere application servers providing ejb services. of portlets use our own home-grown mvc-pattern , written in jsf. recently did proof-of-concept rich/thick-client application communicates directly ejb's on back-end servers. written using netbeans platform , uses websphere application client library establish communication ejb's. the painful bit, getting client use secure jaas/ssl communications. but, after resolved, we've found rich client has number of advantages on web-based portal client applications we've become accustomed to: enormous performance advantage (corba vs. http, cut out portal server middle man) development simplified , faster due use of netbeans' visual designer , swing's robust architecture the debug cycle shortened not having deploy client application test server no ...

python - pylint balks on reference to __package__ -

i'm using __package__ in setup.py refer top-level name of package it's supposed test, build, install, etc.. however, pylint objects: module 'mian.mian' has no '__package__' member this works fine in ipython : from mian import mian package package.__dict__ ... '__package__': 'mian', is pylint doing right thing here, ignoring pep 366's "when import system encounters explicit relative import in module without __package__ set (or set none), calculate , store correct value"? if so, need change? workaround: use package.__name__.rpartition('.')[0] instead of package.__package__ . this ticket on pylint's tracker: http://www.logilab.org/ticket/73668

Haskell and random numbers -

i've been messing haskell few days , stumbled problem. i need method returns random list of integers ( rand [[int]] ). so, defined type: type rand = stdgen -> (a, stdgen) . able produce rand io integer , rand [io integer] ( (returnr lst) :: stdgen -> ([io integer], stdgen) ) somehow. tips how produce rand [[int]] ? how avoid io depends on why it's being introduced in first place. while pseudo-random number generators inherently state-oriented, there's no reason io needs involved. i'm going take guess , you're using newstdgen or getstdgen initial prng. if that's case, there's no way escape io . instead seed prng directly mkstdgen , keeping in mind same seed result in same "random" number sequence. more likely, want prng inside io , pass argument pure function. entire thing still wrapped in io @ end, of course, intermediate computations won't need it. here's quick example give idea: import system.random ...

asp.net - Generic handler (ashx) not rising with jquery autocomplete plugin -

my generic handler not being called when using autocomplete, i have in .aspx page. $(document).ready(function () { $("#test").autocomplete("handlers/myhandler.ashx"); } with files included jquery-1.4.2.min.js , jquery-ui-1.8.custom.min.js i put breakpoint on server never reached, used firebug see if jquery making request , nothing, bug plugin? you not initializing jquery ui autocomplete properly, pass object source property: $(document).ready(function () { $("#test").autocomplete({source: "handlers/myhandler.ashx"}); } passing string directly used access 1 of methods, example: $("#test").autocomplete("enable");

.htaccess - Apache mod_rewrite help, send folder to subdomain -

i want make .htaccess file this: from: http://www.domain.com/example -or- http://domain.com/example to: http://example.domain.com and from: http://www.domain.com/example/newfolder/file.html?q=blank -or- http://domain.com/example/newfolder/file.html?q=blank to: http://example.domain.com/newfolder/file.html?q=blank for life of me, have searched , searched, , can't figure out. try rule: rewritecond %{http_host} ^(www\.)?example\.com$ rewriterule ^([^/.]+)(/.*)?$ http://$1.example.com$2 [l,r=301]

c++ - How does server management software work? -

how server management software work? i reading software, , found can monitor cpu speed/temperature. how can 1 in c++? traditionally, motherboards come device drivers provide functionality query temp sensors , other motherboard parameters. these drivers can accessed other programs. example, vendors asus have rich guis can present info (by querying driver) or background programs can give alert when crosses threshold (by querying driver). write similar yourself, including server management software. the main problem in heterogeneous environment end different motherboards , different drivers. operating systems provide abstraction layer functionality, can implement things power management. assume modern motherboards have more unified way of accessing sort of information. this not c/c++, except easier access drivers c/c++ languages java, c# or python. in these cases, worth checking if there command-line based program on motherboard cd queries driver, , shell out, execute...

SQL Server: Deleting Rows with Foreign Key Constraints: Can Transactions override the constraints? -

i have few tables foreign key constraints added. these used code generation set specific joins in generated stored procedures. is possible override these constraints calling multiple deletes within transaction, "transactionscope" in c# or cascaded deleting absolutely required? do not use cascade delete, can cause serious performance issues way. best procedure deletes in order lowest child table parent table. disabling foreign keys prescription having data integrity problems. time should done dba extremely experienced , aware of issues cause. if asking question, not yet experienced enough use technique. remember when disable fk, disable not process.

html - "return false" is ignored in certain browsers for link added dynamically to the DOM with JavaScript -

i dynamically add <a> (link) tag dom with: var link = document.createelement('a'); link.href = 'http://www.google.com/'; link.onclick = function () { window.open(this.href); return false; }; link.appendchild(document.createtextnode('google')); //somedomnode.appendchild(link); i want link open in new window (i know it's bad, it's required). tried use "target" attribute, have wrong behavior solution too. my code works in ie , firefox, return false don't work in safari, chrome , opera. don't work mean link followed after new window opened. i think might because of google maps v3 environment... edit: see behavior on actual page: go http://tinyurl.com/29q6nw6 click on marker on map, balloon show. click on title in balloon, link should open in new window (work in ie , ff not in safari, chrome , opera. any welcome! edit2: problem in function "makeinfowindowcontent" in "gmaps3.js". don't ...

django - Some questions about caching -

i using apache webserver django application. how, set caching images , css? ran webpagetest on website, , says "expiration not specified" css , images. but, when use firebug, css files, firebug shows requests , response headers, in cache tab shows device: disk and no requests shown images. so, bit confused. whats happening here.? i have config django static files in apache vhost : alias /static/ "/home/django/projectname/static/" <directory "/home/django/projectname/static"> order allow,deny allow options +followsymlinks expiresactive on expiresbytype image/gif a1209600 expiresbytype image/jpeg a1209600 expiresbytype image/png a1209600 expiresbytype text/css a1209600 expiresbytype text/javascript a1209600 expiresbytype application/x-javascript a1209600 <filesmatch "\.(css|js|gz|png|gif|...

android - Scroll an Image horizontal and vertical -

i know question has been asked before, couldn't answer issue. have large image, , display it's full sizes (in fact custom map image). know image can scrolled swiping finger, question if there way implement vertical / horizontal scrollview this. able use scrollview features (swiping finger image scrolling itself). using horizontalscrollview inside scrollview didn't work either. horizontal scroll bar appears sometimes, , there no way can scroll in both directions. appreciated. thanls lot, gratzi i've answerd question here images in scrollview in android however not scrolling itself, need more programming.

If the "with" statement in Javascript creates a new scope, why does this closure doesn't contain the new "x" in new scope each time? -

if with statement in javascript creates new scope, shouldn't clicking on links show different x in different scopes? doesn't. <a href="#" id="link1">ha link 1</a> <a href="#" id="link2">ha link 2</a> <a href="#" id="link3">ha link 3</a> <a href="#" id="link4">ha link 4</a> <a href="#" id="link5">ha link 5</a> <script type="text/javascript"> (i = 1; <= 5; i++) { with({foo:"bar"}) { var x = i; document.getelementbyid('link' + i).onclick = function() { alert(x); return false; } } } </script> the with statement doesn't creates full new lexical scope, introduces object in front of scope chain, example, if capture i variable, work : for (var = 1; <= 5; i++) { with({x:i}) { document.getelementbyid(...