Posts

Showing posts from February, 2013

c - How do I return a printf statement if the user inputs nothing? -

i want execute statement based on input of user: #include <stdio.h> #include <string.h> void main() { char string_input[40]; int i; printf("enter data ==> "); scanf("%s", string_input); if (string_input[0] == '\n') { printf("error - no data\n"); } else if (strlen(string_input) > 40) { printf("hex equivalent "); } else { printf("hex equivalent "); } } when run it, , press enter, goes new line instead of saying "error - no data". what do? cannot use fgets have not gone on in class. use char enter[1]; int chk = scanf("%39[^\n]%c", string_input, enter); but string_input not have '\n' inside. test if (string_input[0] == '\n') { printf("error - no data\n"); } will have changed to, example if (chk != 2) { printf("error - bad data\n...

mysql - Queuing SQL requests PHP -

is possible queue client requests accessing database in mysql. trying concurrency management. mysql locks can used somehow not able desired outcome. effectively trying is: insert in new row select column row store value in variable the issue comes when 2 different clients insert @ same time, variables both clients store value of last insert. i worked following alternative, failed in few test runs, , bug quite evident: insert lock table select store unlock thanks! my best guess have auto-increment column , want value after inserting row. 1 option use last_insert_id() (details here , here ). if not applicable, please post more details. trying , queries being fired?

regex - How to match only odd occurrences of a character at the end of the line using grep -

for example, i'm matching odd occurrences of 'a'. "helloaaa" should match while "helloaaaa" should not match. i've tried "(aa)*a$" , without -e option on bash. your problem helloaaaa matches because of last 3 a s: helloaaaa === to avoid need make sure previous character not a : grep -e '[^a](aa)*a$' filename here i'm assuming line isn't entirely a s. if entire line can a s can use regular expression instead: grep -e '(^|[^a])(aa)*a$' filename

Calling COM method in DLL using the JNI -

i'm trying integrate third party dll using jni. i've written test class see if can call method in dll i'm getting "unsatisfiedlinkerror" error. the class looks following: public class mytest { native string configurerequest(string a, string b, string c, string d); static { system.loadlibrary("my_dll"); } @test public void quicktest(){ string result = this.configurerequest("1", "1", "1", "nocontrolbar"); system.out.println("result: " + result ); } } i have used typelibrary viewer investigate dll , can see method there (although says in package "eiacominterface.txnrequests" i'm wondering need specify package somewhere on method). can verify method parameters correct. can advise on please? thanks lot, gearoid. it looks though jacozoom possible solution above problem. in case, turns out can use soap query webserv...

sql - Relationship between Customer and Order in a Shopping Cart -

i'm making erd, can build shopping cart. i confused relationship between order , customer. if im not mistaken, customer can order many products, an order can placed 1 customer so create table orderproduct( orderproductid int primary key, productid int, quantity int ) create table orders( orderid int primary key, orderproductid int, //foregin key customerid int, date ) am correct, or mu table structure wrong? that seems fine me, need orderid in orderproduct table in order link order details order - drop orderproductid orders. some of other columns productid , customerid should foreign keys, of course. is "order" finalized order or there later invoicing step? because typically may want lock in unit price @ order (from product file @ time of order, or perhaps signed/approved quote).

c++ - catching an exception in a loaded shared library -

is catching exception thrown in loaded shared library portable? i've noticed works dlfcn.h , wonder if behaviour in general expected, example when using loadlibrary on windows instead? example code: main.cpp : #include <stdexcept> #include <cstdio> #include <dlfcn.h> typedef void(*dummy_t)(); int main() { dummy_t f; void* handle; handle = dlopen("module.so", rtld_lazy); f = (dummy_t)dlsym(handle, "modulemain"); try { f(); } catch(std::runtime_error& e) { fprintf(stderr, "caught exception: %s\n", e.what()); } dlclose(handle); } module.cpp : #include <stdexcept> extern "c" void modulemain() { throw std::runtime_error("some terrible error occured"); } yes, should work fine under windows.

html - background color of <a href> not displaying properly inside list -

Image
i'm trying create tab buttons putting hyper links inside list within unordered list. after want change color of tab when mouse hovered on it. in below code able change color green it's not covering tab, instead space exists on right , left side of link <a> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> <style type="text/css"> #header ul { list-style: none; margin: 0; } #header li { float: left; padding:10px; padding-left:12px; border: 1px solid #bbb; background:red; margin: 0; } #content { clear:both; } #header { text-decoration: none; padding: 10px; text-align: center; ...

webdav - Davenport on tomcat -

i trying make samba shares available via webdav , there many references davenport (http://davenport.sourceforge.net/), there not information how set tomcat (i don't know tomcat well.) know of howto or @ least basic instructions on how configure davenport tomcat? just had same thing myself. first, make sure tomcat6 installed, move contents of webapp/root folder folder davenport. moved /usr/share/davenport. finally, create xml file in /etc/tomcat6/catalina/localhost points folder. mine so: <?xml version="1.0" encoding="utf-8"?> <!-- licensed apache software foundation (asf) under 1 or more contributor license agreements. see notice file distributed work additional information regarding copyright ownership. asf licenses file under apache license, version 2.0 (the "license"); may not use file except in compliance license. may obtain copy of license @ http://www.apache.org/licenses/license-2.0 unless required applicable law o...

Facebook App Users List -

i new facebook apis. want list of friends have installed app. (the idea being can start game them). this gives list of friends: fb.api('/me/friends', ... this gives app info: fb.api('/myappid', ... what want "my friends have app installed" i thought might this: fb.api('/myappid/accounts', ... i hoping @ least give me developers, administrators or testers, no such luck. http://developers.facebook.com/docs/test_users/ http://developers.facebook.com/docs/applicationsecurity/ my feeling perhaps have use fql construst query says like (psuedocode) select my_friends uid in ( select uid app_users appid = myappid ) any advice appreciated. note, have seen post: facebook app: retrieve list of ids of application's users i keeping local list of facebook user's ids belong site, , able achieve goal doing following, sure there must better way: $facebookfriendids = array(); $friends = $this->facebook-...

c++ - compile-time counter for template classes -

imagine have lot of classes lot of different template parameters. every class has method static void f() . want collect these function pointers in list l. a run-time solution easy: typedef void (*p)(); std::vector<p> l; int reg (p x) { static int = 0; l.push_back(x); return i++; } // returns unique id template <typename t> struct regt { static int id; }; template <typename t> int regt<t>::id = reg (t::f); template < typename ... t > struct class1 : regt< class1<t...> > { static void f(); }; template < typename ... t > struct class2 : regt< class2<t...> > { static void f(); }; // etc. the compiler knows f() s of instantiated classes @ compile-time. so, theoretically should possible generate such list (a const std::array<p, s> l s ) compile-time constant list. how? (c++0x solutions welcome, too). why need this? on architecture 256 kb (for code , data), need generate objects incoming ids of classes. exist...

winapi - How To Use the SHGetKnownFolderPath Function from Vb6 -

i adding windows 7 support existing vb6 project , have ran problem locating special folder paths using shgetfolderpath not supported on windows versions starting vista. know should use shgetknownfolderpath cannot find example implementing using shgetknownfolderpath api call in vb6. easier use shell object late binding advised because microsoft haven't been careful compatibility object. const ssfcommonappdata = &h23 const ssflocalappdata = &h1c const ssfappdata = &h1a dim strappdata string strappdata = _     createobject("shell.application").namespace(ssfappdata).self.path

Drupal 7 pagination in custom view -

i've created custom view page called views-view--projects-landing-page.tpl.php , want include pagination within page. i'm displaying content within page paginate 8 items. please can point me in right direction. thanks on edit page view, make sure you're on page display tab. under basic settings subsection , use pager option.

how to exclude private methods from graphviz/doxygen? -

have doxygen/graphiz running fine java code (via wizard), setting extract_private = no seems relate documentation, not graphing. when using uml_look = yes includes private methods. is there way create dot collaboration/class diagrams via graphviz no include private methods diagrams massive? if set uml_look = no produces basic class diagrams class name , isn't want. i'm afraid not possible using uml_look (or if is, have yet find out how). you generate own dot diagrams or use more powerful/adapted tool, plantuml . it's lot more work on part, you'll want.

'tail -f' a database table -

is possible tail database table such when new row added application notified new row? database can used. use on insert trigger. you need check specifics on how call external applications values contained in inserted record, or write 'application' sql procedure , have run inside database. it sounds want brush on databases in general before paint corner command line approaches.

database - Silverlight 4 with SQLite or alternative -

i making silverlight app , considered straight-forward isn't. i in need create application local database stored on web server silverlight application can connect , whenever user goes on application allow sql queries carried out. main use registration, login , event registration. i have tried community sqlite: http://code.google.com/p/csharp-sqlite/ but had trouble getting work silverlight, guess due poor documentation. have made project containing lot of work want implement sqlite code that. can help thanks. if want silverlight application have local storage database, check out sterling . if want silverlight application query centralized, server-side database, need expose database via wcf. ria services easiest implementation.

perl - How to detect FTP file transfer completion? -

i writing script polls ftp site files , downloads them locally , when available. files deposited ftp site randomly various source parties. need way able detect if file on ftp site has been transferred on source party, before downloading them. thoughts on how go this? thanks in advance help! if cannot manipulate ftp server way of checking comes mind polling filesize , if filesize doesn't change longer time can quite sure upload has finished. nobody can guarantee. ideally can adapt ftp server , make execute script after finishing upload. some pseudo-code: my %filesizes; %processed; sub poll { foreach (@files_on_ftp) { if($_->filesize == $filesizes{$_->filename} , not $processed{$_->filename}) { process($_); $processed{$_->filename)++; } } }

python - Execute Django fixtures on table creation -

is there way execute django fixture once - when appropriate table created? have initial data should put in app tables, once tables there, don't want every ./manage.py syncdb refresh data. according django docs seems can done fixtures in sql format , not json / yaml: http://docs.djangoproject.com/en/1.3/howto/initial-data/ you're going want use post_syncdb signal, , filter/manually load fixture via underlying methods when specific apps or models created.

objective c - NSFilemanager doesn't create file -

i have problem nsfilemanager, because can store file application documents directory, want create file sub directory don't think why, couldn't create. code below: +(nsstring *)applicationdocumentsdirectory { return [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) lastobject]; } +(bool)storefile:(nsdata*)file withname:(nsstring*)name atdirectory:(nsstring*)dir{ nsfilemanager *filemgr; nsstring *docsdir; nsstring *newdir; bool create=no; filemgr =[nsfilemanager defaultmanager]; docsdir = [storagemanager applicationdocumentsdirectory]; newdir = [docsdir stringbyappendingpathcomponent:dir]; if(![filemgr fileexistsatpath:newdir]){ if([filemgr createdirectoryatpath:newdir withintermediatedirectories:no attributes:nil error:nil]){ create=yes; } }else create=yes; if(create){ if(![filemgr createfileatpath:newdir contents:file attributes:nil]){ ...

php - Having multiple RewriteRule -

i have kind of dilemma htaccess file. trying move our site codeigniter , off of miva causing me headaches. this problem my page here , when click on link on top buy equipment miva page codeigniter error here htaccess state directoryindex index.php rewriteengine on rewritecond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ ./index.php/$1 [l,qsa] rewritecond %{request_uri} !\. rewritecond %{request_filename} !-d rewritecond %{request_uri} ^/([\w\-]*)/([\w\-]+)$ [nc] rewriterule (.*) /mm5/merchant.mvc?screen=prod&store_code=pos_systems&category_code=%1&product_code=%2 [qsa,l] # rewritecond %{request_uri} !\. rewritecond %{request_filename} !-d rewritecond %{request_uri} ^/([\w\-]+)/?$ [nc] rewriterule (.*) /mm5/merchant.mvc?screen=ctgy&store_code=pos_systems&category_code=%1 [qsa,l] but if comment out top # directoryindex index.php # rewriteengine o...

opengl - Can't install OpenGLRaw-1.1.0.1 on OS X -

when run $ cabal install openglraw i following errors. ... ... ... cbits/hsopenglraw.c:78:20: error: stdlib.h: no such file or directory cbits/hsopenglraw.c:79:19: error: dlfcn.h: no such file or directory cbits/hsopenglraw.c: in function ‘hs_openglraw_getprocaddress’: cbits/hsopenglraw.c:97:0: error: ‘null’ undeclared (first use in function) cbits/hsopenglraw.c:97:0: error: (each undeclared identifier reported once cbits/hsopenglraw.c:97:0: error: each function appears in.) cbits/hsopenglraw.c:104:0: warning: implicit declaration of function ‘dlopen’ cbits/hsopenglraw.c:104:0: error: ‘rtld_lazy’ undeclared (first use in function) cbits/hsopenglraw.c:104:0: warning: assignment makes pointer integer without cast cbits/hsopenglraw.c:115:0: warning: implicit declaration of function ‘dlsym’ cbits/hsopenglraw.c:115:0: warning: assignment makes pointer integer without cast cbits/hsopenglraw.c:126:0: warning: return makes...

drawing - How can I create beveled corners on a border in WPF? -

i'm trying simple drawing in subclass of decorator, similar they're doing here... how can draw border squared corners in wpf? ...except single-pixel border thickness instead of 2 they're using there. however, no matter do, wpf decides needs 'smoothing' (e.g. instead of rendering single-pixel line, renders two-pixel line each 'half' 50% of opacity.) in other words, it's trying anti-alias drawing. not want anti-aliased drawing. want if draw line 0,0 10,0 single-pixel-wide line that's 10 pixels long without smoothing. now know wpf that, thought that's why introduced snapstodevicepixels , uselayoutrounding, both of i've set 'true' in xaml. i'm making sure numbers i'm using actual integers , not fractional numbers, still i'm not getting nice, crisp, one-pixel-wide lines i'm hoping for. help!!! mark have @ article: draw lines on physical device pixels upd some valuable quotes link: the r...

cocoa - raw data from CVImageBuffer without rendering? -

i'm getting cvimagebufferref avcapturesession, , i'd take image buffer , upload on network. save space , time, without rendering image ciimage , nsbitmapimage, solution i've seen everywhere (like here: how can obtain raw data cvimagebuffer object ). this because impression cvimagebuffer might compressed, awesome me, , if render it, have uncompress full bitmap , upload whole bitmap. take compressed data (realizing single compressed frame might unrenderable later itself) sits within cvimagebuffer. think means want cvimagebuffer's base data pointer , length, doesn't appear there's way within api. have ideas? cvimagebuffer abstract type. image should instance of either cvpixelbuffer, cvopenglbuffer, or cvopengltexture. documentation types lists functions can use accessing data. to tell type have use gettypeid methods: cvimagebufferref image = …; cftypeid imagetype = cfgettypeid(image); if (imagetype == cvpixelbuffergettypeid()) { // pixel data...

oracle10g - Find all references to a specific table column in Oracle (10g) -

possible duplicate: query search packages table and/or column i need able locate references specific column within table in oracle 10g instance. need find references may occur in sprocs, packages, triggers and/or views. this column being removed , new one-to-many relationship taking it's place, need verify touching points single value being referenced can change needed. (note: upgrade 11g scheduled, not imminent) thanks link provided @jonearles & advice @redcayuga. i able discover dependency utilities in toad , have successfuly (i hope) tracked down references in order edit them out. thanks help.

html - i want to fetch this information form that array php? -

array ( [found] => array ( [0] => array ( [id] => 1400 [name] => ?¨?§?³u… u?uˆ?³u? ?´uˆ ?§uâ€Å¾?­uâ€Å¾uâ€Å¡?© ?§uâ€Å¾?³?§?¯?³?© - ?¬uˆ?¯?© ?¹?§uâ€Å¾u??© ?±uˆ?§?¨?· u…?¨?§?´?±?© [visits] => 46 [shortdes] => ?¨?§?³u… u?uˆ?³u? ?´uˆ ?§uâ€Å¾?­uâ€Å¾uâ€Å¡?© ?§uâ€Å¾?³?§?¯?³?© - ?¬uˆ?¯?© ?¹?§uâ€Å¾u??© ?±uˆ?§?¨?· u…?¨?§?´?±?© - ???­u…u?uâ€Å¾ u…?¨?§?´?± ?¹uâ€Å¾u‰ ?§uÆ’?«?± u…u†?³u??±u??± [photo] => http://www.msrstars.com/up//uploads/images/msrstars.com63451f7ada.jpg ) [1] => array ( [id] => 1399 [name] => u…uâ€Å¡?§?±u†?© ?¨u?u†?§uâ€Å¾?µuˆ?± ?§uâ€Å¾??u‰ ?§?³???¹?·u? ?¨u‡?§ ?§uâ€Å¾u?u‡uˆ?¯ ?§uâ€Å¾?¹?§uâ€Å¾u… ?¨?§?«?±u‡ :: u...

erlang - Programming language for number crunching server -

i'm looking programming language scale on multiprocessors , distributed systems, , able work gpu number crunching. think, erlang , cuda match? le: want use image processing: feature detection, bundle adjustment , scene reconstruction; it's parallel. gpu computational intensive part , erlang manage tasks , shuffle data around.

git rebase - When git rebasing two branches with some shared history, is there an easy way to have the common history remain common? -

suppose have following revision graph: a-x-z--b \ \-c with preceding both b , c. further suppose rebase upstream, creating new commit a*, , rebase both b , c onto a*. resulting revision graph following: a*-x'-z'-b \ \-x"-z"-c note shared history no longer shared. there simple way fix this, other than, say, rebasing b , rebasing c onto z' explicitly. in other words there better way automatically rebase multiple branches @ same time in order preserve shared history? seems little bit awkward have either artificially place tag @ split point, or manually inspect graph find out sha1 of commit on rebase c keep shared history, not mention opening possibility of mistakes, since have every time rebase until check changes upstream branch. git rebase --committer-date-is-author-date --preserve-merges --onto a* c git rebase --committer-date-is-author-date --preserve-merges --onto a* b this should keep common commits having same sha1 , merges...

C# casting int to float throwing exception (in runtime) -

this throws exception source can't casted destination: int = 1; object b = (object)a; float c = (float)b; // exception here why? you can cast boxed structs exact type, you'll need cast int first: float c = (float)(int)b; however since there's implicit conversion float int, can do: float c = (int)b;

Current method for using eclipse for java and php? -

super easy question can't find answer on eclipse's website.... i have new laptop , installing eclipse on it. things seem have changed bit since 3.5 version have on current comp. recall dloading eclipse once, , installing plugins stuff php editing. new downloads page seems have entirely different versions different languages: http://www.eclipse.org/downloads/ so need 1 install java, 1 php, 1 else? or method same before? thanks, jonah you can install different development platforms onto base eclipse installation. go help > install new software , try typing in pdt work with text field. should see autocomplete http://download.eclipse.org/tools/pdt/updates/ . if selecting doesn't automatically populate area below, try add button. you should see options pdt sdk can select install. see also: the official installation wiki the package comparison page .

ajax - ASP.NET MVC 3 Partial View dynamically rendered and linked from dynamic list in view -

in mvc 3 application, have view contain partial view. view have list of dynamically generated links. link has cause partial view render detailed information linked item. would use ajax this? if so, since haven't worked ajax before, there documentation using in mvc 3 app? also when view first loaded, partial view either not loaded or ideally show separate partial view. thoughts on way of doing this? thanks help. create action method returns partialviewresult: [httpget] public actionresult detailedlinkinfo(int someidentifier) { var detailedlinkinfo = getfromsomewhere(); return partialview(detailedlinkinfo ); } then create partial view , strongly-typed type of detailedlinkinfo (let's it's dynamiclink . @model webapplication.models.dynamiclink @* bunch of html detailed info *@ then use jquery on client-side. give links class makes easier hook event: $(function() { $('a.dynamic-link').click(function() { $.get('/somecontr...

mysql - What ROW_FORMAT is my table? -

i've discovered mysql has multiple row formats , , it's possible specify or change it. also, default row_format has apparently changed on time mysql versions, understandable. however, can't find anywhere says how find out row_format of existing table is! database has been around years, older versions of mysql, , want make sure i'm not using poorly performing ancient disk format. how find out row_format of table in mysql? information schema offers wealth of information. select row_format information_schema.tables table_schema="your db" , table_name="your table" limit 1; 2014.06.19 - mild update the following query give row format of tables in current database: select `table_name`, `row_format` `information_schema`.`tables` `table_schema`=database();

multithreading - What's the equivalent of ExitThread(ExitCode) and GetExitCodeThread in C# & .net? -

reading vs2008 file i've figured out clean way of exiting thread (in .net) either using return statement (in c#) or letting thread reach end of method. however, have not found method or property allow me set thread's exit code nor way retrieve (as done using win32 api). therefore, question is, how do using c# , .net ? thank help, john. the reason underlying win32 thread primitives aren't exposed prevent managed code relying on them. clr team working on ways optimize thread usage, , includes no guarantees 1:1 managed:unmanaged thread mapping (see "note" on this msdn page , instance). if want anyway, you'll need set p/invoke wrappers use unmanaged thread handle win32 getcurrentthread(), or hook thread mapping process custom host. wouldn't recommend either, unless absolutely have interop uses thread exit codes , isn't managed code-aware. figure out way smuggle state info around if can managed (or use task parallel library abstract lev...

c# - How to map class to database table? -

i'm have classes , need make data tables follow class 1 public class eventtype { public string id { get; private set; } public int severity { get; set; } public eventtypetemplate template { get; set; } public idictionary<string, string> params { get; set; } public eventtype(string id) { id = id; params = new dictionary<string, string>(); } } and second class public class eventtypetemplate { public string id { get; private set; } public int severity { get; set; } public string title { get; set; } public string description { get; set; } public ilist<string> categories { get; private set; } public ilist<string> queries { get; private set; } public eventtypetemplate(string id) { id = id;categories = new list<string>(); queries = new list<string>(); } } for class 1(eventtype) create...

ruby - How to test if parameters exist in rails -

i'm using if statement in ruby on rails try , test if request parameters set. regardless of whether or not both parameters set, first part of following if block gets triggered. how can make part triggered if both params[:one] , params[:two] set? if (defined? params[:one]) && (defined? params[:two]) ... ... elsif (defined? params[:one]) ... ... end you want has_key? : if(params.has_key?(:one) && params.has_key?(:two)) just checking if(params[:one]) fooled "there nil" , "there false" value , you're asking existence. might need differentiate: not there @ all. there nil . there false . there empty string. as well. hard without more details of precise situation.

benchmarking - Modifying the compilation process with SPEC to use LLVM -

i working on running llvm passes , benchmark usefulness using spec 2006 cpu benchmark suite. however, i've not figured out how modify spec setup other use llvm-gcc output llvm bitcode. here i'd modify workflow of spec do: compile .o files llvm llvm-bytecode llvm-gcc -emit-llvm *.c for each .o file, run opt (llvm's optimization pass): opt -adce -mem2reg cfline.o link llvm-link: llvm-link *.o -o out.o.linked turn llvm bytecode assembly llc out.o.linked and turn executable code: gcc out.o.linked -o out.executable is there way can this? know can edit .cfg files emit llvm, don't know how choose different linking/pre-linking procedure. thanks! llvm has test-suite subproject knows how build , run spec. see docs more info.

Cakephp key visible in index list but not value for linked table -

to make clearer (changed after first 2 comments below)... councils controller index, problem numeric 'region_id' displayed on index view instead of linked 'region->name'. function index() { $this->council->recursive = 0; $this->set('councils', $this->paginate()); } councils model: var $belongsto = array( 'region' => array( 'classname' => 'region', 'foreignkey' => 'region_id', 'conditions' => '', 'fields' => '', 'order' => '' ) ); var $hasmany = array( 'person' => array( 'classname' => 'person', 'foreignkey' => 'council_id', 'dependent' => false, 'conditions' => '', 'fields' => '', 'order' => '', ...

javascript - How can I find the length of a specific index in an array -

have tried various things split[6].length string.split[6].length along these lines without success error message last 1 ... referenceerror: "string" not defined. hi replies, in end created array based on index of original array , queried length of that. can see having trouble removing single , double quotes input strings. new javascript , making me little crazy lol. // loop through input messages (var = 0; < input.length; i++) { var next = output.append(input[i]); // body of current input message var body = input[i].text; // set body next.text = body ; next.text.replace(/\'/g, "&#39;"); next.text.replace(/\"/g, "&#34;"); //replace(/['"]/g,''); // set property var split = next.text.split(","); var array1 = split[5]; var array2 = split[2]; next.setproperty("aaalength", split.length); next.setproperty("aaasplitvalue", split.length); next.setproperty("aaaarr...

c# - How to put a strikethrough in a listview or repeater -

i don't know put in strikethrough in listview or repeater.. want have strikethrough in description only.. here asp code: <div class="price" cssclass="sline"><%#renderprice2((decimal)eval("lb_sellingprice"))%></div> thanks! in description add css class , give rule: .yourcssclass {text-decoration: line-through;} <asp:label id="lb_titlelabel" runat="server" cssclass="center-head" text='<%# eval("lb_title") %>' /> <p><asp:label cssclass="yourcssclass" id="lb_descriptionlabel" runat="server" text='<%# eval("lb_description") %>' /></p>

javascript - Integrating JSON feed with Backbone JS -

i'm working on project type keyword inside input box , when click send hits php server link (localhost/json-status.php?query= input text ) , returns whatever after "query=" in json format. i've accomplished jquery , i'm trying again in backbone js. $("#updatestatus").click(function(){ var query = $("#statusbar").val(); var url = "json-status.php" + "?query=" + query; $.getjson(url,function(json){ $.each(json.posts,function(i,post){ $("#content").append( '<div>'+ '<p>'+post.status+'</p>'+ '</div>' ); }); }); }); i've pretty ported on did in jquery on backbone js , it's not working out expected far, please let me know if approach correct , how can solve problem. backbone code: (function ($) { status = backbone.model.extend({ status: null }); ...

c++ - How to integrate QT internationalization to CMake? -

greetings all, i trying use qt internationalization cmake. have configured cmake file follows : #internalization - should generate core_jp.ts ? set(rinzo_core_translations i18n/core_jp.ts ) #these source files in project set(files_to_translate ${rinzo_core_srcs} ${rinzo_core_moh_srcs} ) qt4_create_translation(qm_files ${files_to_translate} ${rinzo_core_translations}) qt4_add_translation(qm ${rinzo_core_translations}) but doesnt genereate ts nor qm files. my questions - 1.does cmake(by using qt tools) generate ts files automatically extracting "tr()" methods source ? (that means dont have create ts file , above i18n/core_jp.ts genereated automatically) 2.what exacly qm files ? thanks in advance in cmake documentation see qt4_create_translation , qt4_add_translation macros. so should followings: set(lang_files example.ts ) ... qt4_create_translation(langsrcs ${lang_files}) ... add_executable(project_name ... others sources ......

jsf - How to preselect a radio button in <af:tableSelectOne>? -

we using oracle adf/jsf 1.1 show search results in table starting radio button. our requirement show search result 1 of <af:tableselectone> radio buttons preselected depending on database value match. however, unable preselect radio button. here code snippet: <f:facet name="selection"> <af:tableselectone text="select" autosubmit="true" id="radiobtn" /> </f:facet> how can preselect it? i believe should change selection strategy :) far know can't configure selection property of af:tableselectone. nested in facet of af:table component, component drives af:tableselectone behaviour. so, in order select row, should check property "selectionstate" on af:table (i suppose you're using adf 10.x version) <af:table value="#{bindings.demoview1.collectionmodel}" var="row" rows="#{demoview1.demoview1.rangesize}" ...

How to write database specific custom validator in Rails 3.0? -

i need write custom validator check if record exists in database or not. sort of opposite of validate uniqueness, couldn't find achieve wanted in built in validators. what i'm attempting check if referrer exists or not in users table. if referrer's username "testuser", want check in users table whether "testuser" exists. i have created custom validator: class referrerexistsvalidator < activemodel::eachvalidator however i'm unsure how proceed fetch details there database, pointers? write following validation class class referrerexistsvalidator < activemodel::eachvalidator def validate_each(object, attribute, value) unless user.find_by_username(value) object.errors[attribute] << (options[:message] || "referrer not exist") end end end add following relevant model validates :referrer_exists => true

java - What happens when base and derived classes each have variables with the same name -

consider int a variables in these classes: class foo { public int = 3; public void addfive() { += 5; system.out.print("f "); } } class bar extends foo { public int = 8; public void addfive() { this.a += 5; system.out.print("b " ); } } public class test { public static void main(string [] args){ foo f = new bar(); f.addfive(); system.out.println(f.a); } } i understand method addfive() have been overridden in child class, , in class test when base class reference referring child class used call overridden method, child class version of addfive called. but public instance variable a ? happens when both base class , derived class have same variable? the output of above program b 3 how happen? there 2 distinct public instance variables called a . a foo object has foo.a variable. a bar object has both foo.a , bar.a variables. when run this: foo f = new bar(); f.addfive(); ...

printing - Print function on jQuery SimpleModal -

i'm using basic modal dialog here http://www.ericmmartin.com/projects/simplemodal-demos/ , inside of dialog, have image add print button below it. i've tried using jqprint doesn't work. there i've missed? my popup dialog <div id="popup_name" class="popup_block"> <div class="map"><img src="images/map.png"></div> <br><a href="#" id="print"><img src="images/print.png"></a> </div> jqprint $("#print").click( function() { $('.map').jqprint(); }); </script> imp: jqprint() plug-in, add proper reference file. try putting click function in document.ready, should work fine then. $(document).ready(function () { $("#print").click( function() { $('.map').jqprint(); }); }); i have tested this, works fine.

iphone - App Crashing- Core Data Problem Or Memory Management? -

Image
console message: had use picture because wasn't formatting correctly in post text. the received memory warning level 2 showed before app crashed. errror comes @ line - cell.textlabel.text = temproutine.name; link full-size picture ( http://www.box.net/shared/static/7igj3r4trh.png ) viewcontroller: @implementation routinetableviewcontroller @synthesize tableview; @synthesize eventsarray; @synthesize entered; @synthesize managedobjectcontext; #pragma mark - view lifecycle - (void)viewdidload { if (managedobjectcontext == nil) { managedobjectcontext = [(curlappdelegate *)[[uiapplication sharedapplication] delegate] managedobjectcontext]; } nsfetchrequest *request = [[nsfetchrequest alloc] init]; nsentitydescription *entity = [nsentitydescription entityforname:@"routine" inmanagedobjectcontext:managedobjectcontext]; [request setentity:entity]; nserror *error = nil; nsmutablearray *mutablefetchresults = [[manage...

html - How would I use javascript to make an image "jiggle" or "shiver"? -

so question simple, i'm building webpage in html , want incorporate little javascript make image "vibrate" or "jiggle" move , forth in relatively tight space/pattern. i did research , found this: copy below code , paste <head> section of page example:<head>code here</head> <style> .jc{ position:relative; } </style> <script language="javascript1.2"> var ns6=document.getelementbyid&&!document.all var ie=document.all var customcollect=new array() var i=0 function jiggleit(num){ if ((!document.all&&!document.getelementbyid)) return; customcollect[num].style.left=(parseint(customcollect[num].style.left)==-1)? customcollect[num].style.left=1 : customcollect[num].style.left=-1 } function init(){ if (ie){ while (eval("document.all.jiggle"+i)!=null){ customcollect[i]= eval("document.all.jiggle"+i) i++ } } else if (ns6){ while (document.getelementbyid("jiggle"+i)!=nul...

c# - How to get status of web service -

how can status of web service using c#? whether completed successfully, failed or pending this. first found question web service database/website status and should try code; system.serviceprocess.servicecontroller sc = new system.serviceprocess.servicecontroller("myservice"); return sc.status and should examine code; public static string pinghost(string args) { httpwebresponse res = null; try { // create request passed uri. httpwebrequest req = (httpwebrequest)webrequest.create(args); req.credentials = credentialcache.defaultnetworkcredentials; // response object. res = (httpwebresponse)req.getresponse(); return "service up"; } catch (exception e) { messagebox.show("source : " + e.source, "exception source",...

c# - Retrieving some values in array -

hi have array of random question nos (ids). have 1 form label question, radiobutton list answers , next button & checkbox review question. when click next button next(random array) question appears. want question id(array) checked review. how can this? used code follows calculates array (like this:10111) gives 1 value checked & 0 unchecked rather want array of question ids checked : //code gives array of checked values in terms of 1 & o int g; if (chkmark.checked == true) { g = 1; } else { g = 0; } int[] chkarray = new int[convert.toint32(session["counter"]) - 1]; int[] temp1 = (int[])session["arrofchk"]; int k, no; if (temp1 == null) no = 0; else no = temp.length; (k = 0; k < no; k++) { chkarray[k] = tem...

Please help with wordpress hide input if empty with custom field -

i made slider can hide if check check box. i gave input can add folder locaton, cant make hide if folder empty or not correct this code <?php if(is_category(7) || is_page(11) && get_post_meta($post->id, 'm_slider', true) == 'true' || 11 == $post->post_parent && get_post_meta($post->id, 'm_slider', true) == 'true') {?> <div id='slider_bg'> </div><!-- slider_bg --> <div id='slider_img'> <div class="slider" > <img src='<?php bloginfo('template_url'); ?>/slider/<?php echo get_post_meta($post->id, 'main_folder', true); ?>/1.jpg'> <img src='<?php bloginfo('template_url'); ?>/slider/<?php echo get_post_meta($post->id, 'main_folder', true); ?>/2.jpg'> <img src='<?php bloginfo('template_url'); ?>/slider/<?php echo get_post_meta($post->id, 'main_fold...

java - What is the highest FlyingSaucer R8 compatible Itext? -

the fs distro comes bundled itext 2.0.8 , given many more recent releases in 2.x.x range wondering if had experiences in more recent releases. guesssing there chance fs might compatible 3.x.x.x +... anybody know/confirm ? i tried 2.1.7 , has class (api) changes cause flying saucer linkageerrors...so n short no appear 2.0.8 latest supported version.

javascript - How to pass parameter dynamically to JQuery click event from HTML elements? -

first of all, have mention newbie in javascript , jquery world. not sure if put down appropriate title question i'll try best explain problem. scenario: have list of items names being displayed. when 1 of items being clicked, popup should show , display description of item. description retrieved server via ajax call upon click. ajax call requires unique id of item (in database) provided. here comes problem has 2 parts: i don't know how , include item id in html. note list displays item name not id. assume 1) resolved, how can pass id of item that's being clicked ajax call. this html of list of items. can see, illustrates part 1) of problem (ie. don't know how include ids in html). <ul> <li class="item">item1</li> <!-- item has id=1 in database --> <li class="item">item2</li> <!-- item has id=2 in database --> <li class="item">item3</li> <!-- item has id=3 i...

java - Add a Button dynamically to a LinearLayout in Android -

i working on project needs add buttons dynamically. whenever run application application force closes. i've learned problem when try add buttons. package com.feras.testproject; import android.app.activity; import android.os.bundle; import android.view.layoutinflater; import android.view.view; import android.view.view.onclicklistener; import android.view.viewgroup.layoutparams; import android.widget.button; import android.widget.linearlayout; public class testproject extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); addall(); // set text button in old testament } public void addall() { linearlayout linearlayout = (linearlayout)findviewbyid(r.id.layout1); button btn = new button(this); btn.settext("mybutton"); linearlayout.addview(btn); } } try this: linearlay...

Map external directory outside tomcat installation in eclipse Dynamic Web Project -

i want map external directory outside tomcat installation stores images in eclipse dynamic web project's tomcat server. have done in tomcat directly adding context tag in server.xml file. when done in eclipse dynamic web project's tomcat server.xml file. not working. using tomcat 6. my question is: how map external directory outside tomcat installation in eclipse dynamic web project? is way map external directory outside tomcat installation? thanks brajesh try linked resource. go folder in want external directory apprear. open file menu -> new -> folder. type in name. click on "advanced >>". select "link alternate location (linked folder)". browse external directory. click finish. that creates link workspace external directory. it's possible plugin supports that.

wolfram mathematica - FITS Export with custom Metadata -

does has experience in exporting data fits file custom metadata ( fits header) information? far able generate fits files standard mathematica fits header template. documentation gives no hint on whether custom metadata export supported , how might done. the following suggestions comp.soft-sys.math.mathematica not work: header=import[<some fits file>, "metadata"]; export<"test.fits",data ,"metadata"->header] or export["test.fits",{"data"->data,"metadata"->header}] what proper way export own metadata fits file ? cheers, markus update: response wolfram support: "mathematica not yet support export of metadata fits file. example referring importing of data. plan support in future..." "there plans include binary tables fits import functionality." i try come workaround. according documentation v.7 , v.8, there couple of ways of accomplishing want, , have ...

javascript - Removing last 9 characters from a string and then reformatting the remaining date characters -

my question has 2 parts. first remove last 9 characters generated string using jquery eg 2011-04-04t15:05:54 which leave date remaining. know use .substring function. after time removed need reformat date format 08.04.11 (for eg) i learning how write jquery , appreciate code. this pure javascript, jquery not needed. var d1=new date(); d1.tostring('yyyy-mm-dd'); //returns "2009-06-29" d1.tostring('dddd, mmmm ,yyyy') //returns "monday, june 29,2009" another example fit case: var d1=new date(); d1.tostring('dd.mm.yy'); //returns "08.04.11" more: where can find documentation on formatting date in javascript?

wcf - How can i Send response to authorize client? -

just finished first wcf service. i want limit client service wcf server - want response client have right password ( password send string in 1 of argument field ) or response client have specific ip address. how can in wcf ? thanks help. the "normal" expected behavior wcf service to: return valid result users authorized call service throw faultexception (possibly typed faultexception<securitynegotiationexception> ) users not authorized

PHP code in viewing a pdf file from a mysql database -

how view .pdf file in webpage using php? pdf file in mysql database. thanks. if echo contents database browser , provide appropriate content type through http headers you're done! <?php header('content-type: application/pdf'); echo $pdf_from_database;

mysql - acts-as-taggable-on and select fields -

i'm using actsastaggableon gem rails 3.0 , works fine. now i'm trying speed queries selecting fields activerecord: @items = item.select("items.id, items.title").where("items.title not null) @items.tag_counts but got error mysql: > activerecord::statementinvalid: mysql::error: operand should contain 1 column(s): select sql_no_cache tags.*, count(*) count `tags` left outer join taggings on tags.id = taggings.tag_id , taggings.context = 'tags' inner join items on items.id = taggings.taggable_id (taggings.taggable_type = 'item') , (taggings.taggable_id in(select items.id, items.title, items.id `items` (title not null))) group tags.id, tags.name having count(*) > 0 instead if regularly call tag_counts on collection works: @items = item.where("items.title not null) @items.tag_counts any ideas simple workaround without editing gem?