Posts

Showing posts from July, 2014

c# - Problems in generating random colors -

i want generate random colors in wpf , store them in array. random r; color[] colarr = new color[6]; (int = 0; < colarr.length; i++) { color c=new color(); r=new random(); r.next(); c.r = (byte)r.next(1, 255); c.g = (byte)r.next(1, 255); c.b = (byte)r.next(1, 255); c.a = (byte)r.next(1, 255); c.b = (byte)r.next(1, 255); colarr[i] = c; } but elements of array represent 1 single color. when debugged code, found random colors every element, when code executed(not in debug mode) same color generated. makes clear code correct, there problem while execution. edit : how can increase randomness of colors generated? the problem making new instance of random each run. should set once. the default seed random system time, same if repeat fast loop; time won't change lot. if set @ start, random work expected. i suggest use r.next(0, 256) , since give value ranging 0 255. also, call r.next() after definition of color c unnecess

opengl - GLSL - Weird syntax error "<" -

i'm trying use shader keeps telling me error on both fragment , vertex shader: error(#132) syntax error: "<" parse error vertex shader varying vec4 diffuse; varying vec4 ambient; varying vec3 normal; varying vec3 halfvector;   void main() {     normal = normalize(gl_normalmatrix * gl_normal);       halfvector = gl_lightsource[0].halfvector.xyz;       diffuse = gl_frontmaterial.diffuse * gl_lightsource[0].diffuse;     ambient = gl_frontmaterial.ambient * gl_lightsource[0].ambient;     ambient += gl_lightmodel.ambient * gl_frontmaterial.ambient;     gl_position = ftransform();   } fragment shader varying vec4 diffuse,ambient; varying vec3 normal,halfvector;   void main() {     vec3 n,halfv,lightdir;     float ndotl,ndothv;       lightdir = vec3(gl_lightsource[0].position);       vec4 color = ambient;       n = normalize(normal);       ndotl = max(dot(n,lightdir),0.0);     if (ndotl > 0.0) {         color += diffuse * ndotl;         halfv = normalize(ha

php - How do I find out that a link was seen -

i'm trying make page links , when clicks on link, score count go up. how can find out visitor has really seen page related link? not click link , close page score... really seen means: page loads completed. and links opens in new window. any solution? you cant see pages aren't in same domain. chrome puts them in separate thread. back in day have used css exploit talked here: https://developer.mozilla.org/en-us/docs/web/css/privacy_and_the_:visited_selector if want make page kind of functionality have make browser plugin/extension.

html - why their is little margin in between two red regions of the page shown? -

Image
shown in image below little gap between 2 red regions.. i have set margins , paddings 0 still giving 4px(i think) margin in between.. want know why appearing there... two red regions given floating left , displayed inline-block. <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>learning...</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="_body"> <div id="_header"> <img src="images/header_index.jpg"/> <br /> <h3> view of uttrakhand camera come here , explore whole beauty...</h3> </div> <div id="_navigation"> <ul> <li><a href="htmlpage.html">destinations</a></li> <li><a h

c# - Are there any classes which can supply you with what a MethodInfo/method name would be? -

i wondering if there classes can generate methodbase/methodinfo, or generate method name, without using "magic strings". right i'm doing following: public void foo(methodinfo method) { if (string.equals("get_isbar", method.name, stringcomparison.ordinal)) { // ... } } instead, wondering if there way of getting name, "get_isbar", interface, this: public interface ibar { bool isbar { get; } } public void foo(methodinfo method) { string barmethodname = getbargettermethodname(typeof(ibar), "isbar"); if (string.equals(barmethodname, method.name, stringcomparison.ordinal)) { // ... } } i realize there still "magic string" in there, @ least it's more manageable. use getgetmethod() of propertyinfo : typeof(ibar).getproperty("isbar").getgetmethod().name

html5 - How do you center a line-wrapped <nav> menu in CSS? -

Image
i have ul centered in wide , narrow widths breaks in mid range. when wide fits nice, when browser narrow stacks nice, when using mid width, 800px wide, menu wraps next line, works now, see if possible center second row of links. here screenshot of how looks on top (red circle), , want on bottom (green circle). if @ another thread , see kind of how menu works right in example link . if shrink browser on example notice menu wraps , second row left aligned. i have second row centered under first row in picture above. possible? here html: <div id="navcontainer" <ul> <li class="menu_home"><a href="/">home</a></li> <li class="menu_gallery squished"><a href="/galleryintro.php">gallery of properties</a></li> <li class="menu_service"><a href="/service.php">service options</a></li> <li class=&

android - Launching an activity from notification -

i trying launch activity notification. have activity a. activity launched clicking on notification. once activity launched, mainactivity upon pressing phone's button. happen implement follow. code implemented in broadcastreceiver. having compilation error @ line intent resultintent = new intent(mainactivity.this, theclass); because mainactivity.this not valid in broadcastreceiver class. how can make correct? class theclass = class.forname("sg.santhit.trackme.notificationlistactivity"); intent resultintent = new intent(mainactivity.this, theclass); resultintent.putextra("mobilenumber", tel); taskstackbuilder stackbuilder = taskstackbuilder.create(mainactivity.this); // adds stack intent (but not intent itself) stackbuilder.addparentstack(theclass); // adds intent starts activity top of stack stackbuilder.addnextintent(resultintent); pendingintent resultpendingintent = stackbuilder.getpendingintent( 0,

android - string doesnt set off if condition but log output suggests it should -

so im making app uses sms send data between 2 devices , trying 1 automaticly respond other. string getmessagebody() returning isnt setting of if statment send automatic message tho log output "(test)" seems match condition. have added text either side of string in log message check whitespace. in advance. the code sending message received. sendsms(inputnum.gettext().tostring(),"test"); the receiver code public void onreceive(context context, intent intent) { bundle bundle = intent.getextras(); smsmessage[] msgs = null; if(bundle != null) { object[]pdus = (object[]) bundle.get("pdus"); msgs = new smsmessage[pdus.length]; for(int = 0;i < msgs.length;i++) { msgs[i] = smsmessage.createfrompdu((byte[])pdus[i]); originnumber = msgs[i].getoriginatingaddress(); messages =

pdo connection position in php class -

i'm using pdo , have number of classes. every time use class, don't use database-related functions. keep using class until @ end might work database, save object db. so i'm doing this: class { protected $pdo; function connect() { $this->pdo = new pdo( "mysql:host=".zconfig::read('hostname').";dbname=".zconfig::read('database'), zconfig::read('username'), zconfig::read('password')); $this->pdo->setattribute(pdo::attr_errmode, pdo::errmode_exception); } /* lots of functions doing lots of non-db things */ function savetodb() { $this->connect(); $this->pdo->prepare("some sql saves stuff"); // db-related pdo work } } my question - reasonable? way lot of code? as see it, there 3 options: the way i'm doing - connecting database in functions database related. these means each time run db-related fun

php script displays nothing in browser, inspect elements shows <!--?php echo 'Some text'; ?--> -

php script displays nothing in browser, inspect elements shows <!--?php echo 'text here can't see'; ?--> this code: <html> <head> <title>something</title> </head> <body> <h1>something texttexttext</h1> <?php echo 'text here can't see'; ?> </body> </html> when open in browser, get-"something texttexttext" , not "text here can't see". for 1 thing, echo statement closes prematurely ' in can't . try: <html> <head> <title>something</title> </head> <body> <h1>something texttexttext</h1> <?php echo "text here can't see"; ?> </body> </html>

iOS - UIButton does not appear on UIView -

this tweak supposed cover lockscreen view (which happen) , add "ios" button view (which not). here's code: #import <uikit/uikit.h> #import <springboard/springboard.h> @interface themos -(void)unlock; @end %hook springboard -(void)applicationdidfinishlaunching:(id)application { %orig; uibutton *button = [[uibutton alloc] initwithframe:cgrectmake(10,10,80,30)]; [button addtarget:self action:@selector(unlock:) forcontrolevents:uicontroleventtouchupinside]; [button settitle:@"ios" forstate: uicontrolstatenormal]; uiwindow* window = [uiapplication sharedapplication].keywindow; uiview *polygonview = [[uiview alloc] initwithframe: cgrectmake ( 0, 0, 640, 960)]; polygonview.backgroundcolor = [uicolor redcolor]; [window addsubview:polygonview]; [polygonview addsubview:button]; [window makekeyandvisible]; [polygonview release]; [button release]; } %new(v@:) -(void)unlock { [self unlockwithsound:yes

java - Idle time for Earliest deadline algorithm -

i can't figure out how show correct diagram earliest deadline first algorithm idle times. far here code: import java.util.*; class deadlineprototype { public static void main(string args[]) { scanner sc = new scanner(system.in); system.out.println("enter no. of processes : "); int n=sc.nextint(); int job[]=new int[n+1]; int burst[]=new int[n+1]; int newburst[]=new int[n+1]; int arrival[]=new int[n+1]; int deadline[]=new int[n+1]; int wt[]=new int[n+1]; int turn[]=new int[n+1]; int tot_turn=0; int tot_wait=0; float avg_turn=0; float avg_wait=0; int j; for(int m = 1; m <= n; m++) { arrival[m]=m; } for(int m = 1; m <= n; m++) { job[m]=m; } for(int m = 1; m <= n; m++) { system.out.println("enter arrival time, burst time , deadl

java - Plug-in display 3d-objects from VRML or X3D -

i'm not sure such plug-ins exist.. program displays data convertible vrml or x3d file, convenient if display rendered these files figures directly in window of program. can suggest plugin java or solution automate this? if program generates or reads 3d mesh data (triangles) , able create string object containing defined x3d document representing these 3d objects java 3d(tm) api , xmodelimporter api might provide solution you. xmodelimporter provides java 3d importers "extensible 3d (x3d)" files. in case 'com.interactivemesh.j3d.interchange.ext3d.xmodelreader' seems appropriate importer, alternatively 'com.interactivemesh.j3d.interchange.ext3d.xmodelloader'. the xmodelreader imports x3d files accepting different sources 'java.io.file' , 'java.net.url' external data, 'java.io.reader' should applicable internal stored data, too. following not tested scenario might work: write x3d document stringbuilder object cre

jquery - Why do I have to JSON.stringify before I .parseJSON a result set from Google+ API? -

i started playing around google+ api , have scoured docs. seems pretty straight forward. according google, call on api returns json. why have stringify json before parsing json before call key values in jquery? here sample of code working with: $.ajax({ url: "https://www.googleapis.com/plus/v1/people/{user number}/activities/public?key={my api key}", data: { "maxresults": 20, "verb": "post" }, datatype: "json", type: "get", success: function (data) { var num_actual_posts = 0; data = $.parsejson(json.stringify(data)); var listelements = $('ul#googlefeedul li'); (var = 0; < data.items.length; i++) { if (data.items[i].verb == "post") { $(listelements[num_actual_posts]).append(data.items[i].object.content); num_actual_posts++; if (num_actual_posts > 5) {

c++ - Precise Texture Overlay -

Image
i'm trying set two-stage render of objects in 3d engine i'm working on written in c++ directx9 facilitate transparency (and other things). thought working nicely until noticed dodgyness on edge of objects rendered before objects using 2 stage method. the 2 stage method simple: draw model off-screen ("side") texture of same size using same zbuffer (no msaa used anywhere) draw off-screen ("side") texture on top of main render target suitable blend , no alpha test or write in image below left view 2 stage render of gray object (a lamppost) body in-front of rendered directly target texture. right view two-stage render disabled, both rendered directly onto target surface. on close inspection if side texture offset 1 pixel "down" , 1 pixel "right" when rendered on target surface (but rendered correctly in-place). can seen in overlay of off screen texture (which program write out bitmap file via d3dxsavetexturetofile ) on scree

javascript - Can't align the hidden divs to appear at the center of the page vertically and horizontally on visibility -

i can't align hidden divs @ center of page. if give position them relative , scroll increases move 1 page (i.e div not aligned vertically center of page) should place 3 divs in 1 container div?? please help!!! many in advance.. <body> <div id ="page1" class="page" style=""visibility:visible> content <!-- contains button hides div , makes next div visible --> </div> <div id="page2" class="page"> content <!-- contains 2 buttons , next div --> </div> <div id ="page3" class="page"> content <!-- contains 2 buttons , submit --> </div> </body> the css using is: .page { position: absolute; visibility:hidden; } the javascript used is: <script language="javascript"> var currentlayer = 'page1'; function showlayer(lyr){ hid

Can Android Studio be used to run standard Java projects? -

for times when want isolate java , give quick test.. can run non-android java projects in android studio in eclipse? tested on android studio 0.8.6 - 2.1 using method can have java modules , android modules in same project , have ability compile , run java modules stand alone java projects. open android project in android studio. if not have one, create one. click file > new module . select java library , click next . fill in package name, etc , click finish . should see java module inside android project. add code java module you've created. click on drop down left of run button. click edit configurations... in new window, click on plus sign @ top left of window , select application a new application configuration should appear, enter in details such main class , classpath of module. click ok . now if click run, should compile , run java module. my usage case: android app relies on precomputed files function. these precomputed files generated ja

opencv - Android Studio and Gradle dependency integration -

i'm following this tutorial android studio. have done following steps: creating new project in android studio adding opencv-2.4.5-sdk/sdk/java module right clicked on main module->change module settings-> added above opencv module dependency for mainactivity used following code (stripped down 1 of samples): package com.example.test; import android.os.bundle; import android.app.activity; import android.util.log; import android.view.menu; import org.opencv.android.baseloadercallback; import org.opencv.android.camerabridgeviewbase; import org.opencv.android.camerabridgeviewbase.cvcameraviewlistener; import org.opencv.android.loadercallbackinterface; import org.opencv.android.opencvloader; import org.opencv.core.mat; public class mainactivity extends activity implements cvcameraviewlistener { private camerabridgeviewbase mopencvcameraview; private baseloadercallback mloadercallback = new baseloadercallback(this) { @override public void on

winapi - Is it possible to embed one application in another application in Windows? -

i'm writing windows application in visual c++ 2008 , want embed calculator (calc.exe) comes windows in it. know if possible, , if is, can give me hints on how achieve that? yes, it's possible embed calc in own application still run in it's own process space. there may restrictions imposed uac depend on how calc launched. need change parent of main calc window , change it's style ws_child. void embedcalc(hwnd hwnd) { hwnd calchwnd = findwindow(l"calcframe", null); if(calchwnd != null) { // change parent calc window belongs our apps main window setparent(calchwnd, hwnd); // update style calc window embedded in our main window setwindowlong(calchwnd, gwl_style, getwindowlong(calchwnd, gwl_style) | ws_child); // need update position since changing parent not // adjust automatically. setwindowpos(calchwnd, null, 0, 0, 0, 0, swp_nosize | swp_nozorder); } }

Run WCF service automatically periodically -

this question has answer here: wcf windows service scheduled service 2 answers i need send push notification every day based upon date-time stored in database. want call wcf service problem wcf service should called automatically every day without interaction. how call wcf service automatically? if other idea accomplish task please provide. thanks you can accomplish kind of task ease using windows service. in windows service, add reference web service , create client , invoke service. the windows service have access database choosing data tasks. also, can configure windows service have timer performs tasks @ intervals.

php - Sending delimited from textarea to mysql. Column by "," and row by "\n" -

i need user able enter data textarea in following format. name,email@email.com name,email@email.com name,email@email.com the information sent mysql database. issue want place proper name first column , proper email second column. then, when encounter line break start new row. can this? thanks! as others have said can use explode results array however, problem approach there no guarantee user enter information in correct order. what this. it's still not fool proof (and using separate inputs better) it's better. <?php $textareastring = $_post['textareaname']; $array = explode("\n",$textareastring ); foreach($array $value) { $data = explode(',',$value); if (strpos($data[1], '@')) { $name = $data[0]; $email = $data[1]; }else{ $name = $data[1]; $email = $data[0]; } } ?>

regex - Automatically paraphrasing sentences in JavaScript -

in javascript, possible automatically replace regular expression in sentence randomly generated match of regular expression? i'm trying use approach automatically paraphrase sentence using list of regular expressions, so: replacewithrandomfromregexes("you aren't crackpot! you're prodigy!", ["(genius|prodigy)", "(freak|loony|crackpot|crank|crazy)", "(you're |you |thou art )", "(aren't|ain't|are not)"]) here, each match of each regular expression in input string should replaced randomly generated match of regular expression. function replacewithrandomfromregexes(thestring, theregexes){ //for each regex in theregexes, replace first match of regex in string randomly generated match of regex. } this seems simpler think. how about: function randomreplace(subject, groups, wordsonly) { var meta = /([.?*+^$[\]\\(){}|-])/g, = {}; groups.foreach(function(group) { group.foreach(functi

Excel VBA using FileSystemObject to list file last date modified -

this first time asking question i'm following protocol. in reference "get list of subdirs in vba" get list of subdirs in vba . i found brett's example #1 - using filescriptingobject helpful. there's 1 more data element (datelastmodified) need in results. tried modify code keep getting invalid qualifier error. here code modifications made: range("a1:c1") = array("file name", "path", "date last modified"). do while loop added => cells(i, 3) = myfile.datelastmodified. will appreciate include "date last modified". santosh here complete code comments indicating modifications. public arr() string public counter long sub loopthroughfilepaths() dim myarr dim long dim j long dim myfile string const strpath string = "c:\temp\" myarr = getsubfolders(strpath) application.screenupdating = false 'range("a1:b1") = array("text file", "path")' <= orig code ran

javascript - Programmatically switch to production sources for webpage -

i have website project includes several javascript files @ end of body of index.html , 3rd party libraries, rest wrote: <html> ... <body> ... <script src="lib/lib1.js"></script> <script src="lib/lib2.js"></script> <script src="js/js1.js"></script> <script src="js/js2.js"></script> ... </body> </html> for production, naturally want optimized set of includes. one, part of larger build process (using maven) of non-library javascript combined, optimized , minified. use minified library files (perhaps cdn): <html> ... <body> ... <script src="lib/lib1.min.js"></script> <script src="//cdn/lib2.min.js"></script> <script src="js/combined.min.js"></script> ... </body> </html> a similar process used our css. so, question is: what techniques people use

ios - Is it possible to display UITableViewCellStyleValue1 and UITableViewCellStyleSubtitle within the same row -

i display information below , infront of main content in row in table view, possible? something like...see screenshot. https://www.evernote.com/shard/s157/sh/b5527a4b-c079-4ca6-9dc8-f9fdc8760816/0d83416b09e8e52ee341bc171a34ad5b thanks make subclass of uitableviewcell , exposes correct outlets. something this @interface mycustomuitableviewcell < uitableviewcell @property (nonatomic, readonly, weak) uilabel *title; @property (nonatomic, readonly, weak) uilabel *subtitle; @property (nonatomic, readonly, weak) uilabel *title; - (id) initwithreuseidentifier:(nsstring*)identifier; @end you can create ui programmatically or build cell nib , connect outlets. note: new ui should added contentview property of uitableviewcell. here few similar questions subclassing uitableviewcell correctly? http://blog.giorgiocalderolla.com/2011/04/16/customizing-uitableviewcells-a-better-way/ http://mobile.tutsplus.com/tutorials/iphone/customizing-uitableview-cell/ (shows

c++ - Assigning Comma Delimited Data to Vector -

i have comma delimited data in file, so: 116,88,0,44 66,45,11,33 etc. know size, , want each line own object in vector. here implementation: bool addobjects(string filename) { ifstream inputfile; inputfile.open(filename.c_str()); string fileline; stringstream stream1; int element = 0; if (!inputfile.is_open()) { return false; } while(inputfile) { getline(inputfile, fileline); //get line file movingobj(fileline); //use external class parse data comma stream1 << fileline; //assign string stringstream stream1 >> element; //turn string object vector movingobjects.push_back(element); //add object vector } inputfile.close(); return true; } no luck far. errors in stream1 << fileline and push_back statement. stream1 1 tells me there's no match << operator (there should be; included library) , latter tells me movingobjects undeclared, seemingly thinking function, when defined in header vector

servicestack - Unable to access javascript file (.js) using Service Stack Razor -

i'm using service stack razor (servicestack.razor.3.9.45) , can't access js nor css file. server error in '/' application. type of page not served. description: type of page have requested not served because has been explicitly forbidden. extension '.js' may incorrect. please review url below , make sure spelled correctly. requested url: /scripts/bootstrap.js version information: microsoft .net framework version:4.0.30319; asp.net version:4.0.30319.18044 any welcome [edit] have same problem razorrockstar webhost application. this should resolved in latest servicestack v3.9.46+ release.

java - Insert only if row doesn't exist -

i using preparedstatement prepare sql queries. want insert row in table if , if doesn't exist. i tried - insert users (userid) values (?) on duplicate key update userid = ? but unnecessarily update userid. how can insert userid here ? insert users (userid) select ? not exists ( select * users userid = ? )

actionscript 3 - replace doublebackslash with single slash -

how replace doublebackslash single slash? couldnt find example anywhere. ie. "c:\\this\\is\\a\\folder\\myfile.jpg" "c:\this\is\a\folder\myfile.jpg" you can use string.replace() function that: var rx:regexp = /\\\\/g; var s:string = "c:\\\\folder\\\\folder\\\\folder\\\\file.ext"; trace ( s ); s = s.replace ( rx, "\\" ); trace ( s ); you need escape \ character inside literal strings, that's why it's doubled in code above.

Oracle BI Publisher rtf template with output to Excel and injecting a VBA macro -

when creating oracle bi publisher rdf template in microsoft word, intended output microsoft excel; there way inject excel vba macro in excel output file? the rtf template not support macro, means put macro in template, lost during report generation. however, can create excel template , put macro in it. macro available in generated excel file.

Objective-c. Fetching distinct values of attribute from core data -

i have run problem can not solve. have "database" - read core data - have attribute holds value , level. that value -------- level 55 -------------4 33 -------------4 50 -------------5 70 -------------6 44 -------------5 want extract values level 5 , add them together. how can achieve ?i did found "fetch distinct values" on apple dev site, apply extracting values 1 attribute. help appreciated, thank you. if have missed similar topic please provide me link. you can use following fetch request: // fetch request entity: nsfetchrequest *request = [nsfetchrequest fetchrequestwithentityname:@"entity"]; [request setresulttype:nsdictionaryresulttype]; // restrict result "level == 5": nspredicate *predicate = [nspredicate predicatewithformat:@"level == %d", 5]; [request setpredicate:predicate]; // expression description "@sum.value": nsexpression *sumexpression = [nsexpression expressionforkeypath:@"@su

dynamic - java polymorphism not working, what am I missing? -

i have following hierarchy in project: public abstract class abstractmessage extends abstractentity{} public class parsefailedmessage extends abstractmessage {} public class subparsedfailedmessage extends parsefailedmessage {} i have following methods: public abstractmessage dohandle(abstractmessage messagetohandle) { //preparetohandle(messagetohandle); handle(messagetohandle); //finalize(messagetohandle); return messagetohandle; } @transactional(readonly = false) private void handle(parsefailedmessage message) { message.sethandled(false); } @transactional(readonly = false) private void handle(abstractmessage message) { message.sethandled(true); } for reason when call dohandle(new subparsedfailedmessage()) function being called handle(abstractmessage msg) , not handle(subparsedfailedmessage msg) emphasized text expecting.. can why polymorphism not working here? dohandle declared receive parameter of type abstractmessage. means when

java - How to use a button to call a method from another class? -

i'm pretty new java, i'm trying make basic ui. can use jbuttons call joptionpanes easily, can't use them call class. currently have main class, ui class, , class handles data. in class handles data have method performs basic sum on 2 elements of array: public void firstmonth(){ string ans; int num1 = integer.parseint(sorteddata[0][0][0]); int num2 = integer.parseint(sorteddata[0][0][1]); int sum = num1 * num2; ans=string.format("the sum of day1 , day2 is: %s", sum); joptionpane.showmessagedialog(null, ans, "title", joptionpane.plain_message); } then in ui class try , call when 1 of buttons pressed: public class userinterface extends jframe { getdata = new getdata(); private class myhandler implements actionlistener{ public void actionperformed(actionevent event){ if(event.getsource()==button1){ a.firstmonth(); } } } but when

object - How could I possibly create two of the same thing in java -

okay, question is, in swing, how make 2 of same thing while both have same attributes yet can act independently, example, working on city builder, when uses presses button add oil power station, power station added world, however, there one. how make player make seamless amount of same building yet act independently, e.g when go add second of same building first 1 won't follow mouse. heres current code explain issue: import java.awt.color; import java.awt.graphics; import java.awt.image; import java.awt.event.keyadapter; import java.awt.event.keyevent; import java.awt.event.mouseadapter; import java.awt.event.mouseevent; import javax.swing.imageicon; import javax.swing.jframe; public class game extends jframe{ public image map; public image utilbutton; public image resbutton; public image oilplantbox; public image apartmentblockabox; //building img public image oilpowerstation; public image apartmentblocka; //util selects boolean showutil = false; boolean utilselect

validation - Validator.w3.org doesn't understand my HTML 4.01+RDFa -

i have following code in page head: <!doctype html public "-//w3c//dtd html 4.01+rdfa 1.0//en" "http://www.w3.org/markup/dtd/html401-rdfa-1.dtd"> <html xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>"> <head> <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8"> if try validate page validator.w3.org , automatic doctype detecting, 174 errors , doctype shown -//w3c//dtd html 4.01+rdfa 1.0//en. here validation result . then if setting doctype manually html 4.01+rdfa 1.1 , revalidate page , doctype shown html 4.01 transitional, there 2 errors , 2 warnings: unable determine parse mode , doctype override in effect! validator seems not understand doctype , writes: the detected doctype declaration >!doctype html public "-//w3c//dtd html 4.01+rdfa 1.0//en"

patch - how to make install file to change few files only -

for every once week or once every 2 weeks, 2-5 files in 1 application modified - of them few lines in text file. i make instruction change contents manually want make install file change 2-5 files automatically when user installs new patch. size won't problem since everytime update required, total 5-10 lines in different text files modified. is there application can use this? i've looked nsis it's installing set of files applications.. in windows.

css3 - JQuery - on the fly CSS animation change only happens when I Ieave browser window and return -

i've been working on day part of larger self-project , have come across slight problem: http://jsfiddle.net/gyv22/2/ i trying change speed of ball on fly using faster/slower buttons. used remove current css animation style (with old speed), found works expected without doing this, , appends new style (with new speed), animation using keyframes utilising translate3d property. not sure if best way it, thought better suited using classes dynamically changing animation speed constantly. function animate(x, y) { $('#xspeed').html(x); $('#yspeed').html(y); var horizontalcss = 'updown ' + y + 's infinite linear'; var ballcss = 'leftright ' + x + 's infinite linear'; $('#horizontal') .css('-webkit-animation', horizontalcss) /* chrome */ .css('-moz-animation', horizontalcss) /* firefox */ .css('animation', horizontalcss); /* ie

Building a DLL with MinGW and loading it with Python's ctypes module -

i trying build c dll can loaded within python using ctypes.windll.loadlibrary(...) i can create dll , client program in c work following mingw tutorial @ http://www.mingw.org/wiki/msvc_and_mingw_dlls . when try load same dll within python error: oserror: [winerrror 193] %1 not valid win32 application can give me idea doing incorrectly? here files: noise_dll.h #ifndef noise_dll_h #define noise_dll_h // declspec identify functions exported when // building dll , imported when 'including' header client #ifdef building_noise_dll #define noise_dll __declspec(dllexport) #else #define noise_dll __declspec(dllimport) #endif //this test function see if dll working // __stdcall => use ctypes.windll ... int __stdcall noise_dll hello(const char *s); #endif // noise_dll_h noise_dll.c #include <stdio.h> #include "noise_dll.h" __stdcall int hello(const char *s) { printf("hello %s\n", s); return 0; } i build dll with: gcc -c

php - SQL COUNT from one table where condition from another table is true -

okay, let's have 2 tables, "tablea" , "tableb". in table have column "c", , in table b have column "d" , column "e". tablea contains lot of rows can contain same value in column c. tableb contains lot of rows, column d has unique (it's autoincrement number). tableb's column e can contain same value in different rows. well, column c , column d contain same numbers. example tables tablea id c ---------- 1 1 2 1 3 2 tableb d e ---------- 1 1 2 0 3 0 now, want count rows in tablea in column c, have figured out how do. however, additionally want give me result count of c equivalent value in d has e of "1". so, have tried this, failing , cannot think of i'm doing wrong or how fix it. googling count gets me results dealing 1 table. in example, want count c id number matches in tableb column d e = 1 (so, tableb column d = 1), , return count, want return me (or effect):

eclipse - Can I use Play 2.1 Template Editor and autocomplete for HTML? -

is there way use template editor , html editor @ same time? features autocomplete html in template editor, or css autocomplete. scala ide eclipse 3.7.2. ps1: beginner in play/scala, decided install aptana (from update site) small comfortable niceties provides, so, dropped play template editor moment. aptana has coffeescript editor so, helps while studying backbone cofeescript. intellij idea scala , play2 plugins works fine me, autocomplete routes file.

gtk - Trying to populate a GtkComboBox with model in C -

i'm new c , gtk+ problem might painfully obvious. have tried follow examples , tutorials found on net. i want combo box 3 values, middle 1 being default. can set using glade have decided rewrite in c. combobox drawn empty/blank. don't know doing wrong. ... gtktreeiter iter; gtkliststore *liststore; gtkwidget *combo; liststore = gtk_list_store_new(1, g_type_string); gtk_list_store_insert_with_values (liststore, &iter, 0, 0, "don't install.", -1); gtk_list_store_insert_with_values (liststore, &iter, 1, 0, "this user only.", -1); gtk_list_store_insert_with_values (liststore, &iter, 2, 0, "all users.", -1); combo = gtk_combo_box_new_with_model(gtk_tree_model(liststore)); gtk_combo_box_set_active (gtk_combo_box(combo), 1); ... gtk_grid_attach (gtk_grid(grid), combo, 2, 4, 1, 1); ... in original code correctly bound data model combo box did not specified how model should presented (that view part of whole model-view

c - Passing a string and a char to a function -

this code wrote supposed read sentence , character check occurency of character in sentence. works when write code in main, when try use function doesn't work. problem have declaring string , variable char function arguments. wrong? #include<stdio.h> #include<string.h> int occ(char*,char); int main () { char c,s[50]; printf("enter sentece:\n");gets(s); printf("enter letter: ");scanf("%c",&c); printf("'%c' repeated %d times in sentence.\n",c,occ(s,c)); } int occ(s,c) { int i=0,j=0; while(s[i]!='\0') { if(s[i]==c)j++; i++; } return j; } note should getting warning prototype mismatch between declaration of occ , definition, amongst host of other compilation warnings. when write: int occ(s,c) { you using pre-standard or k&r style function, , default types of arguments — since didn't specify type — int . that's ok char parameter;

javascript - Duplicating Div always duplicates -

to better understand question , see code visit fiddle: http://jsfiddle.net/dnyxc/ i have script (below) allows click icon , duplicates table allowing more inputs on included form. issue is, once click icon once duplicate it, anywhere click on table regardless of position duplicates table again. document.getelementbyid('line-duplicate').onclick = duplicate; var = 0; function duplicate() { var original = document.getelementbyid('item-table' + i); var clone = original.clonenode(true); // "deep" clone clone.id = "item-table" + ++i; // there can 1 element id clone.onclick = duplicate; // event handlers not cloned original.parentnode.appendchild(clone); } here html table: <table class="table" id="item-table0"> <tr> <td>item name</td> <td>qty/hrs</td> <td>rate</td> <td>tax rate