Posts

Showing posts from June, 2012

php - getting only certain information from a form -

is there way set of information form? eg <form> <input name='i want this' value='one' type=text /> <input name='and this' value='one' type=text /> <input name='but not this' value='one' type=text /> </form> where, obviously, want first 2 fields not third one? i've got user inventory on website looks this: <form action="" method="post"> <input name='item_id' value='1' type='hidden'> <input type='button' name='slot1' value='1'> <input type='button' name='slot2' value='2'> <input name='item_id' value='2' type='hidden'> <input type='button' name='slot1' value='1'> <input type='button' name='slot2' value='2'> </form> i want users able select, item 1 , equip slot 1 way can think of doing ri...

http - Submit HTML form data using Java to retrieve a download from a jsp application -

i have obscure issue. in process of porting perl java , 1 of methods in perl code posts jsp app , downloads zip file. working part of perl code follows appears using retrieve file. $mech->get ( $url ); $mech->submit_form( fields => { upload => variable1, selectvalue => variable2, }, ); the jsp page follows: <!doctype html public "-//w3c//dtd html 4.01 transitional//en"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>extract features</title> </head> <body> <form action="extract.zip" method="post" enctype="multipart/form-data"> <table> <tr> <th align="left">file:</th> <td><input type="file" name="upload"></td> </tr> <tr> <th align="left">code:</th> <td><select n...

inheritance - How does c# System.Type Type have a name property -

i'm pretty sure related implementing interfaces , inheritance. in c# how system.type class have property name? when example code of type class metadata or using object browser see type class doesn't have: string name defined anywhere. i see type inherits memberinfo , implements _type , ireflect (like this): public abstract class type : memberinfo, _type, ireflect the base class memberinfo has property: public abstract string name { get; } from know, has overridden in derived class because of abstract modifier. don't see in type... then in _type interface there property: string name { get; } and because in interface has no implementation of own either. where name getting defined , how have value in system.type class? or not understanding how inheritance , implementing interfaces works class notice system.type abstract class. means can overriden in subclass. in fact, can see types @ run-time not system.type 's if this: typeof(type)...

opengl es - Android Open GL 1.1 View Rotation -

im new development open gl. trying figure out how rotate view can see sides of object on view. similar how google maps rotations. suggestions? current code. @override public boolean ontouchevent(motionevent e) { float x = e.getx(); float y = e.gety(); switch (e.getaction() & motionevent.action_mask) { case motionevent.action_down: mode = 0; //safety precaution screen taps vs swiping mpreviousx = x;//safety precaution screen taps vs swiping mpreviousy = y;//safety precaution screen taps vs swiping case motionevent.action_pointer_down: if(e.getpointercount() == 2) {//two fingers down olddist = distance(e);//old distance equals new distance motion event mode = 1; } break; case motionevent.action_move: if (mode == 1) { newdist = distance(e); if (newdist > olddist) { // distance increasing ...

internationalization - Troubleshoot i18n YAML in Rails the Easy Way -

i waste tons of time trying construct the proper yaml translating text , labels in rails. is there easy way pinpoint path should use in yaml provide translation? as example, using nested simple_form form erb: <%= f.input :birth_date, as:'string' %> the label birth date , assuming coming model attribute. when debug line , type f.object_name => "user_wizard[children_attributes] here's yaml en-us: simple_form: labels: user_wizard: children_attributes: birth_date: "name date or expected date" is there sure-fire way log, print, probe, watch, render or query give (or one) exact path need in situation? not simple_form or model attribute error messages, buttons, mailers, etc. we have had tons of issues i18n key management well, that's why have decided go down different road , display whole key name, possibility edit in place well. feel solves problem of finding correct key name , filling it....

GZip completely breaks CSS -

i trying compress css file (foundation framework 4). file massive can speed website considerably, everytime gzip it, website loads if there no stylesheets @ all. any please? <3 ignoring compressed css file behavior i'd expect. browsers don't know how unzip file, @ zipped file, don't know it, , "this css file malformed; i'm ignoring it". there ways make css file little smaller - stripping out unneeded whitespace - part you're stuck loading whole thing. if it's taking long load, find way simplify it. how big css file, anyway? if it's big loading slows down page loads, that's kind of impressive. , user's browser should cache after it's been loaded once , not need download again on subsequent pages. slowing down not because of load time, because there many selectors parsing , applying them significant task? if so, improve things breaking css separate files, , load ones need on current page.

php rename() function returns "No such file or directory" error -

i have folder several images in it. the folder photos_1/130730782 the images are .jpg 1.jpg 2.jpg 3.jpg 4.jpg 5.jpg 6.jpg i need rename file this .jpg = 1.jpg 1.jpg = 2.jpg 2.jpg = 3.jpg 3.jpg = 4.jpg 4.jpg = 5.jpg 5.jpg = 6.jpg 6.jpg = 7.jpg i'm using code: $sysid = '130730782'; $dir = 'photos_1/'.$sysid; $myphotocount = iterator_count(new directoryiterator($dir)) - 1; for($i=0; $i<=count($myphotocount); $i++){ $x = $i + 1; if($i == 0){ rename("{$dir}/.jpg", "{$dir}/1.jpg"); }else{ rename("{$dir}/{$i}.jpg", "{$dir}/{$x}.jpg"); } } i error: warning: rename(photos_1/130730782/.jpg,photos_1/130730782/1.jpg) [function.rename]: no such file or directory in /home/content/85/6608485/html/mccloskey/rename.php on line 18 warning: rename(photos_1/130730782/1.jpg,photos_1/130730782/2.jpg) [function.rename]: no such file or ...

python - Cython c++ example fails to recognize c++, why? -

i'm attempting build example 'using c++ in cython' @ the cython c++ page , setup appears not recognize language, c++. the files, taken same page are: rectangle.cpp #include "rectangle.h" using namespace shapes; rectangle::rectangle(int x0, int y0, int x1, int y1){ x0 = x0; y0 = y0; x1 = x1; y1 = y1; } rectangle::~rectangle() {} int rectangle::getlength() { return (x1 - x0); } int rectangle::getheight() { return (y1 - y0); } int rectangle::getarea() { return (x1 - x0) * (y1 - y0); } void rectangle::move(int dx, int dy) { x0 += dx; y0 += dy; x1 += dx; y1 += dy; } rectangle.h: namespace shapes { class rectangle { public: int x0, y0, x1, y1; rectangle(int x0, int y0, int x1, int y1); ~rectangle(); int getlength(); int getheight(); int getarea(); void move(int dx, int dy); }; } rectangle.pyx cdef extern "rectangle.h" namespace "shapes"...

What does "cannot be resolved to a type" mean, and how can I fix it? Java Android 4.0 -

this (supposed be) simple example of implementing dialog in android 4.0. method oncreatedialog() overrides method of same name imported android.app.dialog; code won't compile , generates error message shown in comment below. error message mean , how can fix it? thanks! @override protected dialog oncreatedialog(int id) { switch (id) { case 0: return new alertdialog.builder(this) .seticon(r.drawable.ic_launcher) .settitle("this dialog stupid message...") .setpositivebutton("dig it", //error message: //dialoginterface.onclicklistener cannot resolved type new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int whichbutton) { toast.maketext(getbasecontext(), "gotcha!", toast.length_short).show(); } } ) as error trying tell you, there no type n...

imageview - Android how to get image resource? -

i want check if imageview displaying image, how do that? or maybe if has image @ all? i recommend using getdrawable()-method: http://developer.android.com/reference/android/widget/imageview.html#getdrawable()

How can I use Python namedtuples to insert rows into mySQL database -

i have used namedtuples read rows mysql ... great. can use same mechanism insert rows mysql. system changing quite bit, need simple way map python values columns in database, without having check order of values/columns every time change program using mysqldb library - change namedtuple insert queries behave normal tuples, have maintain order of column/values. can use named placeholders , dicts avoid that. cursor.execute("insert person (name, age) values (%(name)s, %(age)s)", {"name": "bernard", "age": 30}) related question: python mysqldb: query parameters named dictionary

/alfresco/api/service/people only returns 5000 results in Alfresco EE 4.1.4 -

i've run problem call https://localhost:8080/alfresco/service/api/people returning first 5000 users. i can't figure out how rest out of system--that api doesn't appear support "skipcount" argument. i thought might able @ least list of usernames using webdav url ( https://localhost:8080/alfresco/webdav/user%20homes/ ) list, returns first 5000. so, how list of users 5001 onwards? there maxresult param can give. for e.g. https://localhost:8080/alfresco/service/api/people?filter=*&maxresults=10000 if @ jira ticket, you'll see when supply * in query search through solr , when don't it'll search db. if @ java code beneath: public pagingresults<personinfo> getpeople(string pattern, list<qname> filterstringprops, list<pair<qname, boolean>> sortprops, pagingrequest pagingrequest) { parametercheck.mandatory("pagingrequest", pagingrequest); there pagingrequest can supply, page need r...

android studio ctrl + space opens documentation window -

i have updated android studio newest version, when call auto-completion/suggestions ctrl + space suggestion box opens documentation window opens well. has experienced , know how disable opening of documentation window? ctrl-q toggles between doc window states (when using default keymap). possible states are: -hidden -shown side of auto-complete list -docked 1 of tabs if have different keymap, can search action in settings -> keymap. action called "quick doc".

java - commons cli complex argument list -

i trying build complex list of arguments without chaining multiple parsers using commons-cli project... basically trying understand how arguments , optional arguments working together... sample command help $ admin <endpoint> <update> <name> [<type>] [<endpoint>] [<descriptions>] //sample option creation options.addoption(optionbuilder.hasargs(3).hasoptionalargs(2) .withargname("name> <type> <uri> [<description>] [<endpoint>]") .withvalueseparator(' ') .create("add")); commandline line = parser.parse(options, args, true); the commandline not differentiate between required , optional arguments... how can retrieve them without have chain second parser optional options? i'm not sure commons cli works unnamed, position-dependent arguments which, seems like, you're looking for. way write be: option endpoint = optio...

java - How to hide the inactive products from in app billing? -

we have android app supporting in app billing v3. in our tests, else worked fine, found inactive products obtained querying inventory. this how query our google play in app products inventory: arraylist<string> moreskus = new arraylist<string>(); moreskus.add("gas"); moreskus.add("premium"); mhelper.queryinventoryasync(true, moreskus, mgotinventorylistener); ... iabhelper.queryinventoryfinishedlistener mgotinventorylistener = new iabhelper.queryinventoryfinishedlistener() { public void onqueryinventoryfinished(iabresult result, final inventory inventory) { if(inventory.hasdetails("premium")) { system.out.println("inactive product visible app!"); } } }; among 2 products, "premium" inactive, print statement in iabhelper.queryinventoryfinishedlistener still executed! is there way active products only? afaik, can remove sku query list //moreskus.add("premium"...

java - error populating a table using jstl -

i getting following error when trying populate table in view.jsp using jstl access list of objects stored in request object of viewservlet: /web-inf/jsp/admin/view.jsp (line: 34, column: 16) attribute value invalid tag foreach according tld can show me how fix code populate table correctly without error? here relevant parts of view.jsp: <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <table> <!-- here should go titles... --> <tr> <th>type</th> <th>number</th> <th>id</th> </tr> <c:foreach begin="1" end= "${ no }" step="1" varstatus="loopcounter" value="${coursesummaries}" var="coursesummary"> <tr> <td> <c:out value="${coursesummary.cou...

android - CheckBox spacing next to TextView and Button -

Image
my checkbox seems screwing layout quite bit. this want: button | checkbox | textview but checkbox pushing textview way right button | checkbox | textview my xml layout: <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_margintop="15dp"> <button android:id="@+id/signin_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="5dp" android:layout_marginleft="7dp" android:background="@layout/bordersignin" android:textcolor="#ffffff" android:text="@string/signin" /> <checkbox android:id="@+id/st...

objective c - AutoLayout fails, black background and autoresizing masks show up in any case -

i made uiview in storyboard containing 6 uibuttons . wrote constraints support landscape mode portrait mode , put them in 2 different arrays: portraitmodeconstraints , landscapemodeconstraints . when mode changes, old constraints removed , right array gets added. when load view in portrait mode there no problem. constraints work fine, wen turn ios-simulator, i'm getting lot of warnings. constraints work, tested them. constraints make problems ones autoresizingmask. turned them of on view controller using [self.view settranslatesautoresizingmaskintoconstraints:no]; this made no change. debugged little bit , found out there no difference between settranslatesautoresizingmaskintoconstraints:no , settranslatesautoresizingmaskintoconstraints:yes strange , can't understand behaviour. however, deleted constraints manually this: [self.view removeconstraints:self.view.constraints]; now, constraints worked in both portrait , landscape (the uibuttons @ right pos...

c# - Getting generic value from fieldinfo throws exception: "Late bounds operation cannot be performed..." -

i'm trying instance value of generic type static field inside generic class, , throws exception: late bound operations cannot performed on fields types type.containsgenericparameters true public class managertemplate<q, t> : iobjectmanager t : filmation.runtime.engine.objectid, new( ) q : managertemplate<q, t>, new( ) { public readonly static q instance = new q( ); <---- static field } private static void findmanagers( ) { var iobjectmanagertype = typeof( iobjectmanager ); var managers = iobjectmanagertype.assembly .gettypes( ) .where( t => !t.isabstract && t.getinterfaces().any( => == iobjectmanagertype) ); foreach (var manager in managers) { var fi = manager.getfield( "instance" ); var instance = fi.getvalue( null ); <--- exception } } i have tried use getgenerictypedefinition, continues throwing exception. i have se...

wordpress - Statement not working -

i have following statement <?php if (!is_page('home')) { ?> <div id="grey-bar"> <h1><?php the_title(); ?></h1> </div> <?php } ?> <?php if (is_single()) { ?> <div id="grey-bar"> <h1>blog</h1> </div> <?php } ?> the first part ok, second part not remove php tag the_title part, adds word blog after post title. how remove the_title , replace blog? thanks if page not home page, can single page. way logic structured, both clauses execute. you looking this: <?php if (!is_page('home')): ?> <div id="grey-bar"> <h1><?php the_title(); ?></h1> </div> <?php elseif (is_single()): ?> <div id="grey-bar"> <h1>blog</h1> </div> <?php endif; ?> the bracket syntax work too, easier read when embeded html.

php - Looping through users with Instagram API requests is REALLY slow -

i'm trying loop through list of user ids check relationship status on user. (limiting loop 20) takes long enough "fatal php couldn't process in 30 secs error". ...and quite bit more 20 repetitions. is there way make "batch" requests? sending ig list of user ids want check in 1 swoop? here's current snippet: <?php $i = 0; foreach(get_user_meta($user_id, 'followed_users', false) $followed){ if($i < 20){ //makes sure it's real insta user id if(strlen($followed) > 2){ $relationshipinfo = $instagram->getuserrelationship($followed); $relationship = $relationshipinfo->data->outgoing_status; if( $relationship == 'none' ){ //ban them update_user_meta($user_id, 'is_banned', 1); if(!is_page('banned') && (get_user_meta($user_id, 'is_banned', tru...

c++ memory leak in queue initialization -

recently company migrated new servers , program no longer worked correctly. compiles ok, when running errors , crashes while initializing queue. using valgrind can see memory leaks in queue library. code bigger have been hard put in here, cut as thought reasonable. think there might problem can't see concerning versions or something, can suggest hints/help? typedef unsigned char byte; typedef unsigned char boolean; typedef unsigned int uint32; typedef unsigned short uint16; typedef unsigned char uint8; typedef signed long int int32; /* signed 32 bit value */ typedef signed short int16; /* signed 16 bit value */ typedef signed char int8; /* signed 8 bit value */ just type defs next part doesn't confuse struct mipmsg { byte msg[1024]; uint32 msglen; uint32 ipaddr; ushort sin_port; uint32 mnhomeaddr; struct timeval ts; mipmsg() : msglen(0),...

python - counting unique value pairs in pandas -

i have dataframe below: place user count item 2013-06-01 new york john 2 book 2013-06-01 new york john 1 potato 2013-06-04 san francisco john 5 laptop 2013-06-04 san francisco jane 6 tape player 2013-05-02 houston michael 2 computer i'm trying count number of unique (date, user) combinations each place — or, put way, number of 'unique visits' each city. new york one, san francisco two, , houston one. i've tried doing below follows: df.groupby([df.index, user, place]).place.size() returns total count each place. feel i'm missing obvious here, can't see is. help? here's 1 way it, assuming convert index column named date, can pass in show above. input: df.groupby(['place', 'user', 'date']).place.count().groupby(level='place').count() output: place houston 1 new york 1 san francisco 2 dty...

ruby - All Rails urls are returning error 500 -

i have rails app running on development vps ubuntu server apache , phusion passenger. i've developed app on local machine, app working flawless. deployed app, run bundle installs, runing same gem, rails, rvm , rake versions local machine , i've successfuly migrated database (sqlite). but on vps, runing on development enviroment, of routes returning 500 error. googled 2 days , cannot , runing. development log returning 1 line is: connecting database specified database.yml this database.yml set correcty, db/development.sqlite3 present on vps server. development: adapter: sqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000 i desperate now. have sqlite installed, same gems local machine,.. missing here? have compiled assets? rake assets:precompile

phpmyadmin - Why am I getting "Host '192.168.1.220' is not allowed to connect to this MySQL server"? -

this question has answer here: host 'xxx.xx.xxx.xxx' not allowed connect mysql server 14 answers i need run mysql (phpmyadmin) on lan. connection string: function connection() mysqlconnection 'connect database myconnection.connectionstring = "server=192.168.1.101;" _ & "user id=root;" _ & "password=;" _ & "database=db1230018;" ' myconnection.open() return myconnection end function i error: host '192.168.1.220' not allowed connect mysql server i have 2 pcs. 1 of them (windows 7 - 192.168.1.101) runs wamp server (phpmyadmin) , vb.net application using above connection string. want run application on second pc (windows) using same database in 192.168.1.101. define fixed ip on both pcs , disable firewalls. what's going on? probably have no access ru...

java - Unable to retrieve the value of textfield -

i newbee in android development. had developed app contains login, credentials must passed in text field , later call webservice. facing issue user , password not getting copied @ required position. please me out. package com.authorwjf.http_get; import java.io.ioexception; import java.io.inputstream; import java.io.unsupportedencodingexception; import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.client.httpclient; import org.apache.http.client.methods.httppost; import org.apache.http.entity.stringentity; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.protocol.basichttpcontext; import org.apache.http.protocol.httpcontext; import android.app.activity; import android.os.asynctask; import android.os.bundle; import android.util.log; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; public class main extends activity implements...

javascript - getElementByID work in firefox, but not in IE & Chrome -

function change1() { document.getelementbyid("video").src = document.myvid1.vid_select.options[document.myvid1.vid_select.selectedindex].value } <form name="myvid1"> <select id="vid_select" onchange="change();"> <option value="http://www.youtube.com/v/nn8si5lkyy?autoplay=1">test1</option> <option value="http://www.youtube.com/v/cdkutzidzeg?autoplay=1">test2</option> </select> </form> <object width="650" height="450"> <embed id="video" src="http://www.youtube.com/v/iijx4a1cxrk" type="application/x-shockwave-flash" width="650" height="450" /> </object> the above code can work in firefox, not in ie & chrome. try this: <script type="text/javascript"> function change() { var html = '<object width="650" height="450"...

python - ValueError: zero length field name in format -

i trying convert date nice format using below code , runninginto following error..can provide inputs on how overcome here? from datetime import datetime d = datetime.fromtimestamp(1372058963) print d create_date = datetime.strptime(str(d), '%y-%m-%d %h:%m:%s') print create_date gerrit_created_date = "{}/{}/{}".format(create_date.month,create_date.day,create_date.year) print gerrit_created_date error:- file "test.py", line 7, in <module> gerrit_created_date = "{}/{}/{}".format(create_date.month,create_date.day,create_date.year) valueerror: 0 length field name in format better use datetime.strftime : >>> d = datetime.fromtimestamp(1372058963) >>> datetime.strftime(d, '%m/%d/%y') '06/24/2013' >>> datetime.strftime(d, '%m/%d/%y %h:%m:%s') '06/24/2013 12:59:23'

javascript - Decrypt array to string -

i have array looks this: ["screen", "left_side", "left_side", "right_side", "left_side", "right_side", "left_side", "right_side"] i want encrypt somehow can use url, like: http://www.site.com/app.html?array=... because want allow users share arrays. is there way encrypt array it's usable in url string , decrypt later on? you can use atob , btoa functions. myarray = ["screen", "left_side", "left_side", "right_side", "left_side", "right_side", "left_side", "right_side"] btoa(json.stringify(myarray)) // "wyjzy3jlzw4ilcjszwz0x3npzguilcjszwz0x3npzguilcjyawdodf9zawrliiwibgvmdf9zawrliiwicmlnahrfc2lkzsisimxlznrfc2lkzsisinjpz2h0x3npzguixq==" you can convert orignal array array = json.parse(atob(str)) if include lzstring (as mentioned in comments), can shorter strings. var str = btoa(json.s...

What will be the output of my recursive function in C -

consider following recursive c function takes 2 arguments. unsigned int foo(unsigned int n, unsigned int r) { if (n > 0) return (n % r) + foo(n / r, r); else return 0; } what value of function foo when called foo(512,2)? this code ,actually recursion. follow return happened: if n == 0; return 0; if n == 1; return 1+foo(0,2) if n == 2; return 0 + foo(1,2); if n == 4; return 0 + foo(2,2); ... if n == 2^n return 0 + foo(0+foo(z^n-1,2)); .... foo(512,2) == foo (2^n,2) == 0+f(1,2) == 1 +f(0,2) = 1; it return 1.

sorting - Custom Sort using vba code -

for following piece of code, getting runtime error '13', type mismatch error when reaches following piece of code activeworkbook.worksheets("3. pmo internal view").sort.sortfields.add key:= _ f, sorton:=xlsortonvalues, order:=xlascending, dataoption:= _ xlsortnormal that piece of code above in full code below, have placed in bold, towards end of code. what trying filter current state column (which works fine), want custom sort 2nd , 3rd columns ("pcr no." , "accn. id" respectively). work fine if used original recorded code (range("b2:b2000"), sorton:=xlsortonvalues, order:=xlascending, dataoption:=) thing want ensure macro not break if decided column later @ beginning trying custom sort column name not column number. any appreciated here. sub commercialview() ' ' commercialview macro ' ' dim wrkbk, sourcebk workbook set sourcebk = application.activeworkbook 'clear filter columns start activesheet if .a...

batch file - How to make a .bat that will ask yes or no and if the guy clicks yes it will go to website -

hi same question above how make .bat ask yes or no , if guy clicks yes go website. hard me because i'm beginning, tried on start www.websitehere.com and save .bat , works problem want ask questions first if yes or no if wants proceed. very easy: choice /c yn /m "start website?" if %errorlevel% equ 1 start www.websitehere.com exit

php - Error Validation not showing in Codeigniter -

i have code snippet adding patient in system doesn't show error messages. have validation_errors() in views still not showing here's code // add new item public function add() { //some form validation rules here $this->form_validation->set_error_delimiters('<div class="alert alert-error"><i class="icon-exclamation-sign"></i>', '</div>'); $this->form_validation->set_rules('patient_type_id','patient type id','required|trim|xss_clean|integer'); $this->form_validation->set_rules('first_name','first name','required|trim|xss_clean|max_length[50]'); $this->form_validation->set_rules('middle_name','middle name','required|trim|xss_clean|max_length[50]'); $this->form_validation->set_rules('last_name','last name','required|trim|xss_clean|max_length[50]'); $this->form_v...

.net 4.0 - C# - Iterating through repeated context menu items with foreach loops -

i'm working on small project requires repetition in context menu items. menu starts right click context menu , branches out different colours, , objects. depending on colour , object selected, object on form change. it's pretty messy, unfortunately can't see easier way of getting done (and thankfully needs done 1 menu). i've created colours menu items , added them, each colour repeats same 8 objects such: foreach (menuitem in colors.menuitems) { menuitem 1 = new menuitem(); one.text = "one"; menuitem 2 = new menuitem(); two.text = "two"; menuitem 3 = new menuitem(); three.text = "three"; menuitem 4 = new menuitem(); four.text = "four"; menuitem 5 = new menuitem(); five.text = "five"; menuitem 6 = new menuitem(); six.text = "six"; menuitem 7 = new menuitem(); seven.text = "seven"; menuitem 8 = new menuitem(); eight.text = "eig...

sql server - How to improve SQL query performance (correlated subqueries)? -

i write below query in better & efficient way help? select a.assetnum asset, a.assettag asset_tag, a.manufacturer manufacturer, a.serialnum serial, a.description description, ( select case a.isrunning when 1 'operational' when 0 'down' end ) condition , l.kbs_loctag location, ( select top 1 wo.wonum workorder wo wo.assetnum = a.assetnum , wo.worktype = 'un' order wo.reportdate desc ) last_workorder, ( select wo.statusdate workorder wo wo.wonum in ( select top 1 wo.wonum workorder wo wo.assetnum = a.assetnum ...

c# - WPToolkit: TiltEffect Doesn't Seem to be Affecting Image -

i have image: <image height="100" name="imageplay" stretch="uniformtofill" verticalalignment="center" width="100" toolkit:tilteffect.istiltenabled="true" source="/music%20player%20pro;component/images/play.white.png" margin="20,0,0,0" tap="imageplay_tap" /> which doesn't seem show sign of toolkit:tilteffect? i've tried setting larger size see if effect minute see, still nothing seems happen? does know why is? , can fix it? image control doesn't support tilt effect. can put other tiltable controls such stackpanel, grid, border , on. instance putting stackpanel. <stackpanel toolkit:tilteffect.istiltenabled="true"> <image height="100" name="imageplay" stretch="uniformtofill" verticalalignment="center" width="100" toolkit:tilteffect.istiltenabled="true" source="/music%20pl...

random - Python - empty range for randrange() (0,0, 0) and ValueError("empty range for randrange() (%d,%d, %d)" % (istart, istop, width)) -

when run program: (python 3.3.1) import random import time random import randrange print(' ') print('i thinking of person...') time.sleep(1) print('he or belongs group of people:') people = 'alice elise jack jill ricardo david jane sacha thomas'.split() loop = 0 while loop != 6: group = [] person = randrange(0, len(people)) personname = people[person] int(person) group.append(personname) del people[person] loop = loop + 1 i error message: traceback (most recent call last): file "c:\users\user\python\wsda.py", line 132, in <module> person = randrange(0, len(people)) file "c:\python33\lib\random.py", line 192, in randrange raise valueerror("empty range randrange() (%d,%d, %d)" % (istart, istop, width)) valueerror: empty range randrange() (0,0, 0) basically want 6 random names variable 'people' , add variable 'group'... also part of larger pr...

asp.net mvc - Structuring A Linq Query -

i've searched site , googled no avail. perhaps i'm tired , hence googling wrong thing, don't know. i'm wits end , use or advice. i'm building touring site using asp.net mvc 4, , i've encountered problem correct query use information need database. i have class safari stores information particular safari. have class highlight stores information highlights of particular safari. such, safari can have several highlights in one-to-many relationship. had highlights field in safari of type list, still had trouble seeding , querying details "highlights" , field "highlights" not being created in safari table, made highlights class. still wasn't able seed fields highlight, since table created, able manually (so know table has data). i want able query database not availabe safaris, related highlights. i've included classes safari, highlight, safariscontroller , configuration. safari.cs public int id { get; set; } public strin...