Posts

Showing posts from August, 2012

php - css generator to put generated css layout into textarea -

i developing content manager system using php , wonder if there css generator can use plugin. generated code stored in mysql database. i have looked @ many of these here , cant seem see can provide users plugin. i want 1 creates layouts , can change background. if cant one, how create one. i hope cant plugin that, since page designing must known [positioning, font size, etc] first, create complete site css hold layout, a1.css , can same same attributes a2.css, a3.css...etc.. [this may terrible] or can change dynamically jquery generate dynamically , like .css( "padding-left", "+=15" ) or use different frameworks , make accessible, link hope gives idea!

backbone.js - How to show multiple views (CompositeView) in a region - Backbone Marionette -

i have compositeviews, , want render in region. compositeview count dynamic. my solution: container = backbone.view.extend() // not itemview, needs template items = document.createdocumentfragment(); _.each(data, function(m, k) { items.appendchild(new compositeview({collection: new collection(m)}).render().el); }) app.region.show(new container({el: items}))

Javascript: self-executable classes and public functions -

i have lot of following classes: (function() { if (!window.administration) { window.administration = {}; } window.administration.customers = (function() { // code , private methods return { // public methods }; })(); })(); i heard somewhere such declarations of public methods not because js engines create many instances of public methods called them code... true? in case how can refactor code in order solve such memory leaks leave self-executable feature? thank you you use construct instead if you're worried hiding methods: (function(ns) { // default constructor ns.blah = function(v) { this.v = v; setup.call(this); // invoke private method } // private method, invoked using .call(this) function setup() { this.w = this.v + 123; } function myhello() { return 'w = ' + this.w + ' , v = ' + this.v; } ns.blah.prototype = {

python - Get TimesNewswire API, HTTP Error 404: -

i getting data timesnewswire api , using tool http://prototype.nytimes.com/gst/apitool/index.html for example, search specific news item , type in url: http://topics.nytimes.com/top/news/international/countriesandterritories/china/index.html?8qa but still error " http error 404: " here python script: from urllib2 import urlopen json import loads import codecs import time def call_the_articles(): url = "http://api.nytimes.com/svc/news/v3/content.json?&url=http%3a%2f%2ftopics.nytimes.com%2ftop%2fnews%2finternational%2fcountriesandterritories%2fchina%2findex.html%3f8qa&api-key=####" data= loads(urlopen(url).read()) posts = list() item in data["results"]: if'title' in item: posts.append(item) return posts if __name__ == '__main__': story in call_the_articles(): print story['title'].encode('ascii', 'replace') while error shows t

domaincontroller - Can I have users of my PHP/SQL/HTML/Javascript application login through my windows domain controller -

i have application have built users login retrieving username , password ms sql table user info, thinking once implement windows server domain controller, better let sever authentication part rather storing in database , comparing login info there , passing true or false if login successful. is possible or should stick php sql method? you can use php ldap that. ldap

How to show dynamic shipping price in Magento? -

i have integrated matrix rate module shipping method. got requirement for showing dynamic shipping prices changing on warehouse options. for example, have 2 warehouses , b. when user selects warehouse a, shipping prices should updated accordingly. , same case warehouse b. i confused how should this? please help. i struggling similar requirement. have set shipping rate based on user selection of postage method. here how proceeding if helps out: create custom shipping method lets user select warehouse/postage/whatever. shall show in onepagecheckout shipping methods step. can create new shipping method, google out. put if($_rate->getcode()=='yourmodule_code') condition in template/checkout/shipping_method/available.phtml , write code radio buttons user can see. eg. warehouse1 , warehouse2. based on user selection set shipping rate using collectrates() method[which have overridden] of module this public function collectrates(mage_shipping_model_

.htaccess - htaccess rule to rename .php to .html is interfering with other rules -

i attempting change .php files .html extensions , rule using interfering other rules in .htaccess file. appears can either 1 set of rules work or other. check code: options +followsymlinks rewriteengine on ##locations pages rewriterule ^([^/\.]+)\.html?$ locations.php?locationslug=$1&submit=submit [l] ##listing pages rewriterule ^([^/\.]+)\/([^/\.]+)\.html?$ listings.php?locationslug=$1&categoryslug=$2 [l] ##vendor pages rewriterule ^([^/\.]+)\/([^/\.]+)\/([^/\.]+)\.html?$ vendors2.php?vendorslug=$3&locationslug=$1&categoryslug=$2 [l] rewriterule ^(.*)\.html$ $1.php [l] if put line rewriterule ^(.*)\.html$ $1.php [l] 3rd line of file, flat .php pages work .html however, following rules throw error (404 not found). if put line rewriterule ^(.*)\.html$ $1.php [l] last line, flat pages not work .html. as always, constructive input appreciated. in advance! t

directx - Billboard using the Geometry shader -

Image
i trying render billboards using geometry-shader takes points input , outputs triangle stream (using directx11). current result not expect be. for comparison, here 2 screenshots, rendering same set of particles, viewed same direction (more or less, had rotate camera ~90°) , distance, once rendered points , once rendered billboard shader: as can see in second picture, when rendered points, 1 can see particles' moving away center, covering entire screen, whereas when rendered billboard shader, change in scale slightly, remain stationary. unfortunately, don't have clue causing this. i've been following tutorials such this , explains how matrix supposed set-up, result shows either expectations or implementation wrong. the following code billboard shader, builds matrix describe particle's orientation , emits 2 triangles billboard: #include <materials/sceneconstants.hlsl> #include <materials/modelconstants.hlsl> #include <particles/particle.hl

vbscript - Fetch an Unread email from a particular address in outlook with VB Script -

i want email address of unread mail particular sender.i tried following code did'nt work set olapp=createobject("outlook.application") set olmapi=olapp.getnamespace("mapi") set ofolder = olmapi.getdefaultfolder(6) set allemails = ofolder.items each email in ofolder.items if email.unread = true if email.senderemailaddress="kalyanam.raghuram@xxxx.com" msgbox email.subject end if end if next so checked 'email.senderemailaddress' verifying inserting code for each email in ofolder.items if email.unread = true msgbox email.subject msgbox email.senderemailaddress end if next it gave me output cannot understood readable.please let me know solution it. dio mean got ex type address instead of expected smtp? have looked @ _exchangeuser.primarysmtpaddress? in case can use mailitem.sender.getexchangeuser.primarysmtpaddress. prepared handle nulls each value can null.

c - yylineno has always the same value in yacc file -

this question has answer here: flex yylineno set 1 1 answer for 1 project in compilers have 1 problem in syntax analyzer, when go add symbol in symbol table, take same value in yylineno... i did in begining: %{ int yylex(void); int yyerror(char* yaccprovidedmessage); extern int yylineno; //i declare yylineno lexical analyzer extern char *yytext; extern file *yyin; int scope=0; int max_scope; %} and in grammar when go add in symbol table: i.e lvalue: id { printf("<-id"); add_data_to_symbol_table((char*)($1),scope,yylineno); printf("lineno:%d",yylineno); } ; in output when give input different lines doesnt recognize new line if(x<=2) { if(t<1) { k=2; } } the lineno never change,always have 1 value... any i

find - Fastest Method for Retrieving a File Structure (unix shell) -

okay, know can use find return files in directory (and nested directories) match various criteria. however, if want return files no matching of kind, there faster alternatives? i.e - want return files within directory (and nested directories) without performing kind of filtering; there faster way this? when return files, mean isn't directory, , no following of symbolic links (though should included in result). i'm working huge (1,000,000+ files) structure, , find takes @ least 15 minutes complete no criteria other ! -type d, slow, i'm hoping there alternatives can try.

html5 - Simple jQuery slider repeating -

i'm trying make simple jquery slider infinitely repeats. i've put class "hidden" on item hidden, , class "featured" on item not hidden. plan make switch between them fade animation. the problem can't figure out how add class "hidden" featured item, without being changed "featured" right after. how do this? current jquery code: var fadetime = 2500; var slideinterval = 5000; $("article.hidden").hide(); function aslider(){ $("article.featured").removeclass("featured").addclass("hidden") $("article.hidden").removeclass("hidden").addclass("featured").fadein(fadetime); }; setinterval(aslider, 5000); thanks, marius the error inside code: when run first line: $("article.featured").removeclass("featured").addclass("hidden") then run sec

c# - skydrive upload for my WP in-app purchase receipts -

recently in wp8 app, enabled in-app purchases storing confirmation receipts in isolated storage in user device. wanted store them in cloud, skydrive account. i looking way upload them skydrive account, options see related uploading data user's skydrive account. any in regard? there better way receipts in others ways (i not have external site or server store them). that not possible. store on skydrive, have use liveconnect apis using authentication token acquired after user logs in using microsoft-specific page on internet.

c# 4.0 - WCF Async method works on Windows 7 host, but throws signature Exception on XP machine -

my code (target framework 4.0, x86 architecture) works on several windows 7 machines (both client , server) throws invalid async begin method signature exception on windows xp (same .net framework version) specifying method requires iasyncresult result type , callback method. actually, methods use task<generictype> return type , i'm wondering why fails on xp hosts. example of service contract: [operationcontract(asyncpattern = true)] task<getserverconfigurationresult> getserverconfigurationasync(string clientid); note : hope there's smarter solution refactoring.

sql - BCP Parameter issues -

i hope i'm not re-asking.. but.. here's pertinent section of sql. view in question (vw_tempallitems) created in prior steps, , yes created using column names, , paying attention types & etc.. view works 100%.. bcp, not much.. --------------------------------------------------------------- declare @bcpcommand varchar(2000) set @bcpcommand = 'bcp vw_tempallitems out "c:\fepdata.csv" -c -t -u user -p pwd' exec master..xp_cmdshell @bcpcommand go drop view vw_tempallitems go ---------------------------------------------------------------- the thing results pane shows bcp command parameters usage: bcp {dbtable | query} {in | out | queryout | format} datafile [-m maxerrors] [-f formatfile] [-e errfile] [-f firstrow] [-l lastrow] [-b batchsize] [-n native type] [-c character type] [-w wide character type] [-n keep non-text native] [-v file format version] [-q quoted identi

Google Map render events, can they be watched? -

is there way watch completion of rendering of google map tiles? related this, there way test whether or not map tiles rendered? this based on unresolved issue described here . take here part of question is there way test whether or not map tiles rendered?

c++ - How to write a function wrapper for cout that allows for expressive syntax? -

i'd wrap std::cout formatting, so: mycout([what type?] x, [optional args]) { ... // formatting on x first std::cout << x; } and still able use expressive syntax like mycout("test" << << endl << somevar, indent) instead of being forced more verbose like mycout(std::stringstream("test") << ...) how can implement this? type make x ? edit: added consideration optional arguments how this: struct mycout {}; extern mycout mycout; template <typename t> mycout& operator<< (mycout &s, const t &x) { //format x please std::cout << x; return s; } and put mycout mycout; 1 .cpp file. you can use mycout this: mycout << "test" << x << std::endl; and call template operator<< can formatting. of course, can provide overloads of operator special formatting of specific types if want to. edit apparently (thanks @soon), standard ma

javascript - Make text input fields remember previously entered data -

my text inputs seem not remember values have been typed before. example, many websites don't have account on, have, example entered email address before (buying train ticket "guest") give me sort of dropdown email addresses i've used in past. yet form not this. obliges me type out every time. seems opposite of this question .. i have simple inputs <input type="text" id="firstname" placeholder="first name" /> and submitted simple jquery ajax post. this . ajax isn't working on jsbin on example, show demonstrate basic structure. there jquery plugin this? way can control seemingly browser-driven behavior. thanks. in browsers, can make browser display values entered in input fields giving name input. example: <input type="text" id="firstname" placeholder="first name" name="firstname" > if field has no name attribute, browser won't show suggestions. also check if

java - What is the best way to get the fields from a HTML form, and send them to a Servlet using JQuery/Javascript? -

using jquery i've found solutions such this: $("#submit").click(function () { alert($('form1').serialize()); $.post("submitform", $("form1").serialize(), function (result) { if (result == "success") { alert("record added!"); } else { alert("could not add record!"); } }); }); here full html of method had described above, im trying find best way data the html form , send servlet "submitform". <html> <head> <title>myform</title> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <script type="text/javascript"> $("#submit").click(function () { alert($('form1').serialize()); $.post("submitform", $("wmform_174835").serialize(), function (result) { if (result == "success") {

django - Template syntax error with RequestContext(request)) -

Image
the following block of code throwing error , can't figure out why -- haven't changed @ - error started happening: def product_feed(request): """ return site activity friends, etc. """ if request.user.is_authenticated(): return httpresponseredirect("/about/what_next/") else: return render_to_response("homepage.html", {}, context_instance=requestcontext(request)) it's last line returns render_to_response problem occurs. error is: exception type: syntaxerror @ / exception value: invalid syntax (views.py, line 804) screenshot shows issue. traceback: traceback: file "/users/nb/desktop/myenv2/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response 111. response = callback(request, *callback_args, **callback_kwargs) file "/users/nb/desktop/store/views.py" in product_feed 261. return render_to_response("homepage.

javascript - Extracting SQL Server Value from CRM 2011 - How do I do this? -

ok in crm 2011 have field called contract expiry date , want populate value external sql server database...basically need grab value, nothing fancy start? i familiar javascript , how use in crm 2011, however, connecting database not recommended use javascript. start this? run query on load of form in crm. ideas, start .net? thanks help! tudor it depends want, think have 2 options: plugin or batch process. a plugin reacts event (create, update, delete, ...) of entity. if want in of event best solution you. in plugin need connect external database , affect field of entity (you have persist value in 1 entity). if don't have event put code can command line application (batch), can put schedule task, same behavior of plugin (connects external database , affect 1 entity in crm). see here example of plugin.

html - CSS priorities and targeting specific elements -

my question should pretty strait forward. reason can't wrap head around today. i'm making menu structure so <div class="wrapper"> <ul> <li class="menu-item"><a href="#">menu item</a> <div class="inner"> <a href="#">login</a> </div> </li> </ul> </div> i trying target login link using following css selector: .inner a{} the selector working, following selector taking css presidence, , overriding above selector: li.menu-item a{} i'm totally baffled. why second selector take style preference on first? how guys recommend target above "a" elements? why second selector take style preference on first? because second selector more specific first. first contains one class , one type selector while second has one class , two type selectors. to calculate

printing - View/Print function code from within GDB -

i trying develop simple text based user interface runs gdb commands. want user able set , break/trace point @ area of code , run debug commands. i want user enter function needs debugged. take function name , print out source code of function, ask user select line of code @ set break/trace point. @ moment, using disassemble command can print out memory addresses user, want print actual source code instead. can done in gdb? currently: dump of assembler code function test_function: 0x03800f70 <test_function+0>: push %ebp 0x03800f71 <test_function+1>: mov %esp,%ebp 0x03800f73 <test_function+3>: sub $0x48,%esp what want: void main() { printf("hello world\n"); } thanks! edit: i'm getting this: (gdb) list myfunction 941 directory/directory_etc/sourcefile.c: no such file or directory. in directory/directory_etc/sourcefile.c then tried specifying linenum: (gdb) list directory/directory_etc/sourcefile.c:

How does variable binding actually work in groovysh? -

here's crux of don't understand: % groovysh groovy shell (1.8.6, jvm: 1.6.0_21) type 'help' or '\h' help. ------------------------------------------------------ groovy:000> class vars { groovy:001> static int x = 1; groovy:002> } ===> true groovy:000> println new vars().x 1 ===> null groovy:000> println vars.x error groovy.lang.missingpropertyexception: no such property: vars class: groovysh_evaluate possible solutions: class @ groovysh_evaluate.run (groovysh_evaluate:2) ... if vars resolves in expression new vars().x , why not in expression vars.x ? it's phantom identifier exists purposes of instantiation. your code doesn't work because using wrong naming conventions. should write class capital v. way groovy shell knows referring class, instead of variable, in case groovy cannot determine it. this want: groovy:000> class vars { groovy:001> static int x = 1 groovy:002> } ===> true

css - Padding issues while viewing website with mobile device -

can take @ website , me fix mobile display. more setting , fixing padding , margins.. when view website on iphone mess. would use css fix issue have researched can't work yet.the main css mobile target below: @media any appreciated. www.jobspark.ca @media , (max-width: 640px){ #site > .wrapper, #footer > .wrapper { margin: 0; padding: 40px; width: auto; } }

c++ - CodeBlocks 12.11 on-typing annoying tip -

i've changed codeblocks 10.05 12.11, , noticed annoying 'new feature'. when type function c library or stl, annoying 'method signature' appears above text you're typing, tooltip or something, know how remove 'feature'. the 'tooltip text' hides when click on print-screen, it's not possible paste screenshot here.

html - How can Javascript redirect a website user back to login page if need be? -

if website user attempts enter secure page before entering login page whole website, script able redirect him login page without hindering usage of page (after logged in)? i trying javascript , cookies. guys have ideas? ahead of time. i need cookie creation , detection scripts. thank you. you have handle on server-side. if build functionality javascript, disabling javascript allow user access secured content. use server side language this.

change any rule in codeigniter to match function -

i have set routes.php suit nature of site. unfortunately, there problem last route i.e.: $route['(:any)'] = "profile/profile_guest/$1"; if username password name passed correct, e.g. domain.com/username, load his/her data. if not, loads page errors (because failure retrieve data non-existent user in database). problem! want avoid error showing. is there anyway avoid error happening? none of echoes seems printing or redirect neither working. don't know why! if code inside method not executing , view loaded instead. below part of profile_guest function: public function profile_guest($username) { $username = $this->uri->segment(1); //echo "hello " . $username; redirect('main', 'refresh'); if($username != '') { /* echo "<h1>hello world something</h1>"; */ it's hard without seeing rest of code.

c# - The name 'Roles' does not exist in the current context -

i have ported migrations web app class library project. works fine, except can't call static class roles . i have included namespace using system.web.security; roles located. here configuration.cs file contents: namespace _datacontext.migrations { using system; using system.data.entity; using system.data.entity.migrations; using system.linq; using webmatrix.webdata; using system.web.security; internal sealed class configuration : dbmigrationsconfiguration<_datacontext.datacontext> { public configuration() { automaticmigrationsenabled = true; } protected override void seed(_datacontext.datacontext context) { // method called after migrating latest version. // can use dbset<t>.addorupdate() helper extension method // avoid creating duplicate seed data. e.g. // // context.people.addorupdate( // p => p.fullname, // new person { full

Android - Send Image file to the Server DB -

users save 3 data: name , note , image . can see code below, succeeded code send name , note server side. but, have no idea how send selected image file device serverdb. public class addeditwishlists extends activity { // client-server - start ////////////////////// // progress dialog private progressdialog pdialog; jsonparser jsonparser = new jsonparser(); edittext inputname; edittext inputdesc; // url create new product private static string url_create_product = "http://10.56.43.91/android_connect/create_product.php"; // json node names private static final string tag_success = "success"; // client-server - end ////////////////////// //define variables private edittext inputname; private edittext inputnote; private button upload; private bitmap yourselectedimage; private imageview inputphoto; private button save; private int id; private byte[] blob=null; byt

shared libraries - Where and when load a library in luajit ffi -

i making wrapper between c++ engine , lua, i'm using luajit , because of i'm using ffi "wrapper" between these two, since engine has , different parts thinking nice divide them in files , requiring them, however, after reading bit luajit found external libraries have load library, came this: when , should load library? in "glue" code (the 1 wich unifies modules)?, in everyone?, or better keep single file? also, deciding how slow loading library? you can create 'core' module loads library: engine/core.lua local ffi = require'ffi' local c = ffi.load('engine') -- loads .so/.dll ffi.cdef[[ /* put common function/type definitions here. */ ]] -- return native module handle return c then create module each of engine parts: engine/graphics.lua local ffi = require'ffi' -- still need load ffi here. local c = require'engine.core' -- load other dependent parts. -- if module uses types other parts of engine

clojure - Difference between using "def" to update a var and "alter-var-root" -

what's difference between using "def" update var , using "alter-var-root"? e.g. (def x 3) (def x (inc x)) vs (def x 3) (alter-var-root #'x inc) i find alter-var-root comes in idiomatic clojure code; not there wrong it, it's intended corner cases. if find using build loops , such it's sign needs different approach. see in initialization routines setting access credentials or loggers , such. alter-var-root uses function mechanically change value of var while def sets new value. in example equivalent. hello.exp> (def foo 4) #'hello.exp/foo hello.exp> (alter-var-root #'foo inc) 5 hello.exp> foo 5 alter-var-root unwilling create new var: hello.exp> (alter-var-root #'foo1 inc) compilerexception java.lang.runtimeexception: unable resolve var: foo1 in context, compiling:(no_source_path:1) alter-var-root can work on other namespaces well: hello.exp> (in-ns 'user) #<namespace user> user

c# - Three tiers select date from two tables -

i have tried googling lot of things, couldn't find answer - hoping me out! what i'm trying do: on winform application need select computername through combobox, upon selection, listbox populated data computer (softwarename, version , stuff) the combobox working id, not other fields. my listview, using database call, listed bellow: clsoftwareperpc sf = new clsoftwareperpc(); datatable dt = sf.selectsoftware(zoekid); // voor iedere rij een nieuw nummer geven (r) (int r = 0; r < dt.rows.count; r++) { lvi = new listviewitem(); // cdnummer als titel //lvi.text = (string)(dt.rows[r]["idcomputer"]); lvi.text = ((string)(dt.rows[r]["idinstallatie"]).tostring()); // titels toevoegen in deze kolom lvi.subitems.add((string)(dt.rows[r]["softwarenaam"])); lvi.subitems.add((string)(dt.rows[r]["ontwikkelaar"])); lvi.subitems.add((string)(dt.rows[r]["omschrijving"])); lvi.subitems.add((strin

c++ - GD: How to add the text string to the RGB24 buffer image? -

i have rgb24 format stream. each buffer video frame. need add text each frame. problem don't know libgd has method add buffer background rgb24 raw. ideas how that? void * addhello(void * prgb24raw) { int black; gdimageptr im; im = gdimagecreatetruecolor(320,240); // here should set background prgb24raw pointer black = gdimagecolorresolvealpha(im, 0, 0, 0, gdalphaopaque); gdimagestringft (im, null, black, "arial", 12, 0, 2, 14, "hello"); // here should copy modified buffer prgb24raw pointer gdimagedestroy (im); return prgb24raw; }

asp.net - gracefully rejecting RC4 https connections -

due security concerns, looking @ potentially disabling rc4 cipher on our web server (windows 2008 r2) , forcing web clients connecting use more secure protocol (aes128 or aes256) from understand, ie8 running on xp doesn't support these better protocols, mean cutting off segment of our user base. (management aware of implication , ok it). my question is...is there way configure site these rejected https connections handled in user friendly manner? if tries navigate https://mysite.com , ssl/tls negotiation fails, assume end user going cryptic browser message outside of control. can't tell them using alternative browser resolve issue.

Best way to continue a timed out script in php? -

i have php file wrote checks new files in folders, emails off newest files since last run. can 10-15 files being attached email. using swiftmailer send emails. this script can cycle through 50 customers, , each customer can have files need emailed. times, timeout via php , throw error. i've been trying track left off writing customer numbers file via php. how can use php "if there abrupt exit or error, re-run file." another way is.... when timeout error, or other error, can reload php file continue left off? this doesn't seem cleanest way accomplish task, i'm open suggestions. you can track files processed writing flat file or database, removing entry each file completed. when script restarts, read list of files processed , continue left off. additionally, consider increasing timeout setting in php.ini if know script regularly requires more time. in event need restart script continually until processing completed, consider following scena

SPSS chart saved as PNG with OMS or other -

is there way automatically save chart in spss png? need use syntax not usual copy , paste or menu procedure. example oms can save pdf word etc... example: oms /select charts /destination format = doc images = yes imageformat = jpg chartsize = 100 outfile = "my chart.doc". *chart. omsend. but there way automatically save chart png through syntax? the output export command can this. oms imageformat keyword supports png graphics type.

i need away to write rdf triples with Time attributes and make sparql query to get the time -

i have triples: fadi eat apple. (subject = fadi, predicate = eat, object = apple). , have time when fadi eat apple, its: 00:00:13 , have time when fadi ate apple, its: 00:00:50 how can write rdf-triples file times attributes? , how can starttime , endtime sparql query request rdf file? i tried write rdf this: <?xml version="1.0" encoding="utf-8"?> <!doctype rdf:rdf [<!entity rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!entity rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!entity xsd 'http://www.w3.org/2001/xmlschema#'>]> <rdf:rdf xmlns:xsd="http://www.w3.org/2001/xmlschema#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dnr="http://www.dotnetrdf.org/configuration#" xml:base="http://www.example.org/" xmlns:starttime="http://example.org/

javascript - Dynamically Load Div Elements and Assign IDs -

i understand how dynamically load html, having trouble understanding how load it, assign, , keep track of ids elements inside loaded div . this main block <div id="add-equip-container"> <div id="add-equip-content"> </div> <button id="add-equipment">add more equipment</button> <button id="submit-equipment">submit equipment</button> </div> now, every time add-equipment clicked, want load following block add-equip-content . <div class="add-equip-form"> <input id="?" type="text" placeholder="equipment description..."/></br> <input id="?" type="text" placeholder="equipment number"/></br> <input id="?" type="text" placeholder="other stuff..."/></br> </div> each block inserted beneath previous 1 loaded. have no idea

vb.net - implementing mostly repeating content in ASP.NET WebForms' controls -

the original problem how make maintainable code given need have menu bar similar not identical in webforms. at first glance thought wanted make placeholder in custom user control, placed in master page, access placeholder, putting in unique content within webform , happy , maintainable. after reading through forms , through trial , error, realize there problems every solution have tried: putting placeholder control in user control makes placeholder , each of contents difficult access in web form (relying on nested instances of findcontrol("id")), events difficult bubble (i assume have when control created in code behind referenced) or bind (not successful yet despite referencing: http://msdn.microsoft.com/en-us/library/t4z863dh(vs.71).aspx ), , code difficult maintain if want move/rename control. nesting controls gives same problem because want use 1 control - making small modifications on many pages. if nest still have have cross-control knowledge of each other dif

Git deleted files sticking around. How do i get a clean working directory? -

so i'm refactoring views in haml in separate haml branch. accidentally removed new haml views instead of old erb views. $ git rm app/views/projects/edit.html.haml app/views/projects/new.html.haml ..... so did reset $ git reset head app/views/projects/edit.html.haml app/views/projects/new.html.haml ..... unstaged changes after reset: d app/views/projects/_form.html.erb d app/views/projects/edit.html.erb d app/views/projects/edit.html.haml . . . git status shows $ git status # on branch haml # changes not staged commit: # (use "git add/rm <file>..." update committed) # (use "git checkout -- <file>..." discard changes in working directory) # deleted: app/views/projects/_form.html.erb # deleted: app/views/projects/edit.html.erb # deleted: app/views/projects/edit.html.haml . . . where go here in order keep haml files , clean working directory? im sure simple rather ask make worse. thanks you need rese

c# - Recursively checking for a duplicate random number in a database -

i create random number , check if exists in database table. if does, generate 1 , check again, following work? public int generatenumber() { random r = new random(); int num = r.next(1000); //psuedo-code if(num in table) generatenumber(); return num; } it seems based on answers below recursion should avoided here , should auto-increment number, alternative either start auto-increment @ 1 , pad 0's until is 8 characters long or start @ 10,000,000. also, if datatype has varchar(8). how can auto-increment number, store in in varchar(8)? this not problem needs solved recursion. not mention fact if have fair few numbers in database, , loops lots of times, you'll stack overflow error. why not change iterative function: public int generatenumber() { random r = new randon(); int num = r.next(1000); while(num in database) { num = r.next(1000); } return num; } different approach, while i'm here

rest - What is the proper RESTful way to handle a variable response for an endpoint that is based on the type of user that accesses it? -

i have resource endpoints respond differently user tries access endpoint. scenario let have resource endpoint /users , , following usertypes: girluser boyuser admin when girluser executes get on /users want allow other girlusers accessible. expect boyusers have similar result, , admins receive users. my question is more restful to: handle different granttypes or scopes through oauth, using 1 /users endpoint. have different endpoints, such as: users/girls , users/boys , , users/all . have different apis different types of users. i'm totally off-base possible answers , it's don't expect. would change if have other endpoints want operational usertype ? (for example, ones process payments.) thank you. your endpoints should independent of sex of user. what's problem in having common user endpoint. (you doing right already!!) though depends on kind of information want return, kind of resources in hand. returning json/xml? ha

scope - dart method calling context -

i used below see how dart calls methods passed in other methods see context passed in method would/can called under. void main() { var 1 = new idable(1); var 2 = new idable(2); print('one ${caller(one.getmyid)}'); //one 1 print('two ${caller(two.getmyid)}'); //two 2 print('one ${callerjustforthree(one.getmyid)}'); //nosuchmethod exception } class idable{ int id; idable(this.id); int getmyid(){ return id; } } caller(fn){ return fn(); } callerjustforthree(fn){ var 3 = new idable(3); three.fn(); } so how caller manager call argument fn without context i.e. one.fn() , , why callerjustforthree fail call passed in fn on object has function defined it? in dart there difference between instance-method, declared part of class, , other functions (like closures , static functions). instance methods ones (except constructors) can access this . conceptually part of class description , not objec

java - How to add eclipse project's class patth to ant script? -

what easiest way add project's classpath custom ant script inside project? need able run java tasks current project's classpath. project can contain manual classpath entries, maven entries , on - whatever eclipse allows. probably, answer follows: 1) first need export current project build.xml file->export->ant buildfiles . this file can used compile project ant need fact file synchronized project eclipse . inside file contain explicit definition of classpath, these hardcodings under eclipse control. 2) import or include in-sync xml file custom one. 3) inside custom file use <classpath refid="myprojectname.classpath"/>

c# - Appending/Listing LINQ to XML data -

i'm writing function save , read data to/from , xml document through linq. can write document fine, if go add data existing item, adds new item. goal create address book type system (yes know there's 1000 out there, it's learning project myself) , i've tried ini , basic text seems xml best way go short of using local db sql. have: xdocument doc = xdocument.load(@"c:\textxml.xml"); var data = new xelement("entry", new xelement("name", textbox1.text), new xelement("address", richtextbox2.text), new xelement("comments", richtextbox1.text)); doc.element("contacts").add(data); doc.save(@"c:\textxml.xml"); i searched so , can't seem find how append/replace. saves properly, when add document, if want update entry i'm not sure how without creating new " entry " nor have gotten knack of removing one. (i'm new c# still , self-taught pardon obvious i'

PHP SQL Syntax Error? -

session_start(); include 'assets/config.php'; if(isset($_post['username'])){ $queryisusername = ("select count(user) users user = '$_post['username']'"); //error $actionqueryisusername = mysql_query($queryisusername); while($rowisusername = mysql_fetch_array($actionqueryisusername)) { $isusername[] = $rowisusername['count(user)']; } if($isusername[0]="0"){ header("location: login.php?error=e1"); } else{ //do stuff } i'm not sure whats wrong, error. removed if statement , errors vanished. parse error: syntax error, unexpected t_encapsed_and_whitespace, expecting t_string or t_variable or t_num_string in /applications/xampp/xamppfiles/htdocs/craftlist/index.php on line 7 change to $queryisusername = ("select count(user) users user = '".$_post['username']."'"); but not sql injection safe!

sql server - MDX parameter drop down not working in Sharepoint inegrated mode -

hi have mdx report there parameter , every time user sets subscription, next day after cube build parameter causing subscription fail. error see 'the subscription contains parameter values not valid.' im not sure why happening. clues should look. ive been checking [subscriptions] table in ssrs database , seems fine

IOS - XCode 4 - iPhone 6.0 - Add back button to subview -

caution: n00b @ ios development. have read several tutorials , code snippets on past 10 days or so, , have gleaned enough info dangerous. trying accomplish open webview (as sub-view) user login, reason nav controller not displaying button. i've tried few different things no avail, doing wrong, seeking guidance. my nav controller set root controller, , next on stack epviewcontroller. view controller starting point of app. view have 2 buttons, 1 login, , 1 enter data (inconsequential question). epviewcontroller code snippet: - (ibaction)buttontologinview:(id)sender { uiwebview *webview = [[uiwebview alloc] initwithframe:self.view.bounds]; [webview loadrequest:[nsurlrequest requestwithurl:[nsurl urlwithstring:@"http://example.com/wsapi/user/login"]]]; [self.view addsubview:webview]; } this works great, sub-view shows nav bar , remote login page, no button. based on other code snippets tried following (within same epviewcontroller file): - (void)vi

iphone - Translate UIView by dragging another UIView -

Image
please refer image below following question: blue , orange circles see uiview's. able drag blue uiview has uipangesturerecognizer , have orange circle translate accordingly , stay same distance blue circle now. meaning, if drag blue circle down, orange uiview should stay parallel blue circle , translate down well. if drag blue circle right, orange circle should translate right , stay same distance blue circle now. so right circles part of same class have uipangesturerecognizer on them. here code drag these views: -(void)dragging:(uipangesturerecognizer *)p { uiview *newview = p.view; if (p.state == uigesturerecognizerstatebegan) { self.origc = newview.center; } self.delta = [p translationinview:newview.superview]; cgpoint c = self.origc; c.x +=self.delta.x; c.y +=self.delta.y; newview.center = c; [self.delegate refreshview]; } within uipangesturerecognizer class, able obtain translation of pan gesture in coordinate system of specified view with: self.delt

pygame - Making Asteroids Game in Python-Whats wrong with it? -

here source code asteroids game. used tutorial http://comp4431.wordpress.com/2010/08/11/tut-wk-3-asteroids/ followed closely could. besides of missing fetures fire, wrong it? wont display starmap. btw - new python import pygame, random, math pygame.locals import * math import * winflags=0 screenrect=rect(0,0,800,600) #screen res nstars=100 nasteroids=10 #colors black=(0,0,0) white=(255,255,255) yellow=(255,255,0) transparent=(1,2,3) clock=pygame.time.clock() while true: clock.tick(30) class player(pygame.sprite.sprite): color=yellow thrust_value=1.0 turn_speed=5 max_speed=10.0 base_image=pygame.surface((21,11)) base_image.fill(transparent) base_image.set_colorkey(transparent) pointlist=[(0,0),(0,10),(20,5)] pygame.draw.polygon(base_image,color,pointlist) def __init__(self): pygame.sprite.sprite.__init__(self) self.image=self.base_image.copy() self.rect=self.image.get_rect(center=screenre