Posts

Showing posts from 2012

sql server 2008 r2 - sql : which dates contain time between 12:00 and 22:00 -

i have mytable column rectime datetime rectime ----------------------- 2013-05-22 15:32:37.530 2013-05-22 22:11:16.103 2013-05-22 16:24:06.883 2013-05-22 16:38:30.717 2013-05-22 23:54:41.777 2013-05-23 22:01:00.000 2013-05-23 09:59:59.997 i need sql statement tell me dates contain time between 12:00 , 22:00 expected result :- rectime | foo ------------------------|----- 2013-05-22 15:32:37.530 | 1 2013-05-22 22:11:16.103 | 0 2013-05-22 16:24:06.883 | 1 2013-05-22 16:38:30.717 | 1 2013-05-22 23:54:41.777 | 0 2013-05-23 22:01:00.000 | 0 2013-05-23 09:59:59.997 | 0 for use following :- select [rectime] , case when [rectime] >= convert(datetime, convert(varchar(4), datepart(year, [rectime])) + '-' + convert(varchar(2), datepart(month, [rectime])) + '-' + convert(varchar(2), datepart(day, [rectime])) + ' 12:00') , [rectime] <= convert(datetime, convert(varchar(4), datepart(year, [rectime])) + &

ios - Clipping NSString based on length + range of string -

i have large nsstring trim: this example of long string first trim word or words. example, pick word "long". achieve this: nsrange textrange = [[theentirestring lowercasestring] rangeofstring:@"long"]; nsstring *substring = //do individual word(s)?? which result in: long however, need 10 characters in final result. in case final result want achieve is: my long st as can see, evenly add characters on left , right side of word until reach desired character count, placing word or words in middle. any appreciated. as long string doesn't contain defined separator more once, should see right: nsstring *string = @"this example of long string."; nsstring *separator = @"long"; nsinteger desiredlength = 10; nsrange range = [[string lowercasestring] rangeofstring:separator]; if(range.location != nsnotfound) { nsinteger remainder = (desiredlength - [separator length]); nsinteger halfremainder = (remainder / 2

android volley - ResponseDelivery Implementations -

i implement common error handler handle errors of particular status code. every request put on queue have same behavior. 1 scenario upon 401. when 401 status received, show login dialog , replay original request without activity launched request having know it. looking @ implementing custom responsedelivery identical executordelivery. when went this, discovered request.finish method package private. there better way implement kind of behavior volley? thanks start following: public abstract class baserequest<t extends errorresponse> extends request<t> { @override protected response parsenetworkresponse(networkresponse response) { jsonstring = new string(response.data); t parsedresponse = null; try { parsedresponse = parsejson(jsonstring); // can handle type of common errors server if (parsedresponse != null && parsedresponse.geterrorcode() == 401) { return response.

python - Database remote access doesn't work with school internet -

i'm using database freesqldatabase.com python (mysqldb) db= mysqldb.connect(host='sql2.freesqldatabase.com',user='xyz',passwd='xyz',db='xyz') the code work home internet ( tried 3 different ones). however, doesn't work school network. can't connect mysql server on 'sql2.freesqldatabase.com' (10061) any suggestion? thanks depending on error output, means port filtered @ level, possibly @ school if using proxy or firewall. use commandline tools test port access, telnet on windows or nmap on linux . contacting administrator idea.

html - CSS inset border radius with solid border -

Image
i know create inset/inverted borders playing radial-gradient, here: inset border-radius css3 , want know if can draw solid border of 1px around resulting shape, in image: i don't want bottom-left radius inverted border, , background color inside remaining space must transparent. possible css3 , html (i not interested in canvas or svg now)? the demo: http://jsfiddle.net/j8gua/1/ the markup: <figure></figure> the style: figure{ position:relative; width:200px; height:120px; margin:100px auto; overflow:hidden; border:1px solid black; border-right:none; border-bottom:none; border-bottom-left-radius: 5px; border-top-left-radius: 5px; } figure:before,figure:after{ content: ''; position: absolute; } figure:before{ right: -50%; top: 0; background: transparent; width: 172px; height: 200px; border: 1px solid black; border-radius: 100%; box-shadow: 0 0 0 100em red;

constructor - Is there a better way to set relationships in Grails? -

i'm starting learn grails, might noob question. doubt simple, although i've searched , not find asnwer i'm looking for. here's problem: i have domain class has relationship domain class have, this: class class3 { static belongsto = [class1:class1] (...) } and i'm creating action inside controller, receives json object class3. inside json, have id of class1 object of mine. the question is: how create instance of class3, initilizing it's class1 property, having class1's id , not actual instance of it? i'm can for class1.get(parsed_id) (that's i'm doing now, , it's working): def jsonobj = request.json def class3 = new class3(class1: class1.get(jsonobj.class1.id) (...)) class3.save(flush: true) this json looks like: {class1:{id:1} (...)} but think it's little overhead in db instance of class1 initialize class3 relationship , save in db. there better way this? like, save foreign key of class1 inside class3 d

javascript - How to Secure ASP.NET Web API with Cross Domain AJAX Calls? -

i want create api @ www.mydomain.com accessible public websites www.customer1.com , www.customer2.com. these public websites display each customers inventory , not have login features. use ajax calls read data api. how can secure api can accessed via ajax different domains no 1 can access api able scrape of customers data , of inventory? i have tried thinking of different solutions on own either require people login public websites (which isn't option) or require secret "key" displayed publicly in browser source code stolen. any ideas appreciated. thanks! p.s. obstacles going run using javascript & cors need now? anything accessible without authentication browser definition insecure, can't stop that. best bet have have relationship owner of customer1.com , customer2.com - server apps 2 websites make http call , authenticate service. going way avoids cors issues you're talking about. if you've designed client functionality, ca

asp.net - Avoiding an Sql injection attack -

i have asp.net application. in have code: using (data.connexion) { string querystring = @"select id_user , nom, prenom, mail, login, mdp, last_visite, id_group, id_user_status users login =@login , mdp=@mdp"; sqlcommand command = new sqlcommand(querystring, data.connexion); command.parameters.addwithvalue("@login", _login); command.parameters.addwithvalue("@mdp", _password.gethashcode().tostring()); try { sqldatareader reader = command.executereader(); { while (reader.read()) { return view("success"); } } while (reader.nextresult()); } catch { } } when try sql injection attack using login '' or 1=1 -- , attack failed. if change snippet 1 : using (data.connexion) { string querystring = @"select id_user , nom

C# resize generated image; bitmap, argument exception -

Image
i have image object i'm trying resize picture box via bitmap. i have source picture box on desktop , code follows bitmap image = new bitmap(picturebox1.image); size newsize = new size(100,100); image = new bitmap( (image)image, newsize); // here parameter not valid, argument exception unhandled picturebox1.image = (image)image; why exception being thrown? first of all, don't understand why create 2 bitmap objects? why not this: bitmap image = (bitmap)picturebox1.image; size newsize = new size(100,100); bitmap newimage = new bitmap((image)image, newsize); image.dispose(); however don't think exception caused shown code. it's possible read above on screen : newsize {width = 128000 height = 59500} have calculated how big picture? size x 4 bytes of format = 3.0464^ 10. i don't think have enough memory allocate image.

mysql - how to store checkbox item in a database through php -

i coading huge html form store data in database through php checkbox code not working ////check box code//// <li>mother </li><table><tr><td><input type="checkbox" name="mdeceased" value="deceased">deceased</td> <td><input type="checkbox" name="malive" value="alive">alive</td></tr> <tr><td><input type="checkbox" name="mretired" value="retired">retired</td> <td><input type="checkbox" name="minservice" value="inservice">in service</td> <td><input type="checkbox" name="mbusiness" value="business">business</td></tr> ///php code checkbox making variable , using in query /// $mysql = new mysqli('localhost','root','ramsha','scholarships_system') or die ('y

java - JavaFX update textArea -

i have simple javafx application has textarea. can update content of textarea code below inside start() method: new thread(new runnable() { public void run() { (int = 0; < 2000; i++) { platform.runlater(new runnable() { public void run() { txtarea.appendtext("text\n"); } }); } } }).start(); the code write text string textarea 2000 times. want update textarea function implemented outside of start() method. public void appendtext(string p){ txtarea.appendtext(p); } this function can called arbitrary programs use javafx application update textarea. how can inside appendtext function? you give class needs write javafx.scene.control.textarea reference class holds public void appendtext(string p) method , call it. suggest pass indication class method called, e.g.: public class mainclass implements initializable { @fxml private textarea txt

How to choose combination of Firefox and Selenium Webdriver versions for web automation? -

if choose latest version of firefox or latest version of selenium-webdriver, couldn't automate few tests because of either not supported in latest version of firefox or latest version of selenium-webdriver. in such situation, combinations of firefox version , selenium webdriver version should choose? (i mean, should go one/two version of latest firefox version and/or one/two version of latest selenium webdriver version or other combination?) use whatever acceptance criteria states. if have support earlier version of firefox because in contract or requirement, must test version , use whatever version of selenium necessary

how to use signals and slots in blackberry cascades -

how read data qml page using signals how wite received data in qml page using signals i excatly expect qtsignals , slots concepts. please tell how read , wrote data qml page. try following syntax , sample github 1.hpp file q_property(qstring companyname read companyname write setcompanyname notify companynamechanged) void companynamechanged(); void setcompanyname(const qstring &company); qstring companyname() const; qstring m_company; 2.cpp file void applicationui::setcompanyname(const qstring &company) { if (m_company == company) return; m_company = company; emit companynamechanged(); } qstring applicationui::companyname() const { return m_company; } ------------------- sample full code here ( click here )-----------

javascript - Can't get the select object in a JQuery widget. Require.js & QUnit is used -

i have following code widget. widget searchpod. file searchpod.html <select class="search-by" id="searchby"> <option value="search_by">search by</option> <option value="lastname">employee last name</option> <option value="ssn">employee ssn</option> <option value="eeid">employee eeid</option> <option value="claim_number">claim number</option> <option value="leave_number">leave number</option> </select> i have file called sptest.js tries use select above. function inside test function since using qunit unit tests. define( ['../widget/searchpod/searchpod'], function () { function checksearchby() { test('check if select has "search by" text', function () { alert($("#searchby option[value='search_by']").text()); alert($(

c# - Are LDR Hotfixes for .Net cumulative? -

i suspect encountering problem addressed hotfix: http://support.microsoft.com/kb/2640103 i trying figure out whether kb titled" "hotfix rollup .net framework 4 june 2013 includes fix after: http://support.microsoft.com/kb/2828843 now, i'm tempted "well, duh, it's rollup.". but, if scroll down list of "issues hotfix rollup resolves", fix not listed. in fact 7 items listed. mean rollup addresses 7 issues? i read how decode gdr vs. ldr version numbers here: http://blogs.technet.com/b/mrsnrub/archive/2009/05/14/gdr-qfe-ldr-wth.aspx , here: http://blogs.technet.com/b/mrsnrub/archive/2010/07/14/gdr-amp-ldr-the-next-generation.aspx (interesting reading, way). and found listing of .net 4.0 releases: http://blogs.msdn.com/b/dougste/archive/2011/09/30/version-history-of-the-clr-4-0.aspx but, still can't answer question. boils down to: june 2013 rollup ldr branch 2008. hotfix looking in ldr branch 526 (which, according revision hist

.net - Generate Power Point Documents Wrapper DLL -

we generating various power point documents on regular basis using built in automation in office. problematic since natively power point , other office automation not run in background on server without hacks. hacks in place there still limitations , regular issues. because openxml radically different application automation , due how involved steps are, hoping find third party or shared dll make transition far easier recoding openxml. similar structure regular automation. basically i'm trying find utility similar "epplus" specific pptx format files (would ideal). can recommend have had results with?

python - How to create a dynamic HttpResponseRedirect using Django? -

i have 2 urls share 1 inclusion_tag, inside of inclusion tag have url displays form , form redirects 1 of 2 urls. how can make redirection dynamic? e.g. if form in url_1 redirect url_1 , if it's in url_2 redirect url_2? here code better explanation (hopefully): form.html # form lives inside of inclusion tag, many urls display <form method="post" action={% url cv_toggle %}> <input type="hidden" name="c_id" value={{ c.id }}> ... {% csrf_token %} </form> views.py # corresponds name="cv_toggle" url def toggle_vote(request): ... next = reverse("frontpage") # url should redirect current # url requested, , not "frontpage" return httpresponseredirect(next) you can use request object determine current url this: <form method="post" action="..."> <input type="hidden" name="next" valu

string - Python - Extracting a substring using a for loop instead of Split method or any other means -

this question exact duplicate of: splitting input 2 for-loop 2 answers i'm taking online python course poses problem programmer extract substring using loop. there similar question asked year ago, didn't answered. so problem reads: write program takes single input line of form «number1»+«number2», both of these represent positive integers, , outputs sum of 2 numbers. example on input 5+12 output should 17. the first hint given is use loop find + in string, extract substrings before , after +. this attempt, know wrong because there no position in loop equals '+'. how find position '+' in string "5+12"? s = input() s_len = len(s) position in range (0,s_len): if position == '+': print(position[0,s_len]) **spoiler alert - edit show csc waterloo course takers answer s = input() s_len = len(s) pos

Echo Execute PHP Code -

is possible execute php code in echo? need finish work, try seems fruitless; bump either blank browser page or errors. it not need echo func. here example of code compile. sample nothing flashy. echo example, put more complex , advanced code @ echo's place start simple stuff that. <?php $code = "<?php echo '123'; ?>" echo $code; ?> that is....an epic fail catastrophe. whatever reason, i'm answering... need use eval() . don't it. read here: http://php.net/manual/en/function.eval.php perhaps need use include 'path/to/file/with/my/code'; . read here: http://php.net/manual/en/function.include.php based on comments, think you're looking this: echo htmlspecialchars(file_get_contents(__file__)); that display php code ran. search line , remove before displaying. write function @ of included files , add them $variable displayed, using same logic.

c# - WCF DataContract DataMember as simpleType in XSD? -

using wcf , datacontract serializer, how can represent data member reflect simpletype when viewing xsd. example: [datacontract(namespace="http://mydomain.xyz/example")] public class mytype { [datamember(isrequired=true)] public somebasicdatatype basicattribute { get; set; } [datamember(isrequired=true)] public somecomplextype complexelement { get; set; } } basically, want somebasicdatatype <xs:simpletype name="somebasicdatatype "> in the accompanying xsd instead of <xs:complextype name="somebasicdatatype"> xsd not allow simple types contain either elements or attributes defined elsewhere in schema. simple types created deriving them existing simple types (built-in data types , other derived simple types) simple types derived restriction , can derived list or union.

Redirect to a different page after POST using AngularJS -

after searching , not coming solution posting code snippet help. $scope.createaddress = function () { $http({ method: 'post', url: '/addressbook/api/person', data: $scope.person, headers: { 'content-type': 'application/json; charset=utf-8' } }).success(function (data) { $location.path('/addressbook'); }); } after posting redirect different page. $location.path not accomplishing this. have tried $scope.apply() others have had success that. missing or not understanding $location used for? code being hit. there should listening on path change, $routeprovider . case? if need full page reload other (server-side) route might try $window.location.href .

sum same column across multiple files using awk ? -

i want add 3rd column of 5 files such new file have same 2nd col , sum of 3rd col of 5 files. i tried this: $ cat freqdat044.dat | awk '{n=$3; getline <"freqdat046.dat";print $2" " n+$3}' > freqtrial1.dat freqdat048.dat`enter code here`$ cat freqdat044.dat | awk '{n=$3; getline <"freqdat046.dat";print $2" " n+$3}' > freqtrial1.dat the files names: freqdat044.dat freqdat045.dat freqdat046.dat freqdat047.dat freqdat049.dat freqdat050.dat and saved in output file contain $2 , new col form summation of 3rd awk '{x[$2] += $3} end {for(y in x) print y,x[y]}' freqdat044.dat freqdat045.dat freqdat046.dat freqdat047.dat freqdat049.dat freqdat050.dat this not print lines appear in first file. if want preserve sorting, have save ordering somewhere: awk 'fnr==nr {keys[fnr]=$2; cnt=fnr} {x[$2] += $3} end {for(i=1; i<=cnt; ++i) print keys[i],x[keys[i]]}' freqdat044.dat freqdat045.da

Batch File: Append a string inside a for loop -

i have following loop: for /l %%a in (1,1,%count%) ( <nul set /p=" %%a - " echo !var%%a! ) which display this: 1 - rel1206 2 - rel1302 3 - rel1306 i need create variable appends based on number of iterations. example variable after loop: myvar="1, 2, 3" example: @echo off &setlocal set /a count=5 /l %%a in (1,1,%count%) call set "myvar=%%myvar%%, %%a" echo %myvar:~2% ..output is: 1, 2, 3, 4, 5

codeigniter - .htaccess not redirecting from old url to new url -

i have developed website using codeigniter. site had long url structure have made them shorter in new website. although used redirect directive in htaccess gives me 404 error. have removed old controllers , functions. below few lines htaccess (there many urls redirecting new ones) rewriteengine on # redirect non-www urls www rewritecond %{http_host} ^mysite\.com [nc] rewriterule (.*) http://www.mysite.com/$1 [r=301,l] #rewriterule ^([^_]*)_(.*)$ /$1-$2 [r=301,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /index.php?/$1 [l] redirect 301 /payments/charity_and_donations/paid http://www.mysite.com/charity redirect 301 /outwards/office_furniture/damaged http://www.mysite.com/office_assets redirect 301 /funding/business_and_person/inward http://www.mysite.com/funds can tell me why not redirecting old new , doing wrong? you need have redirecting happen before route uris /index.php . also, since redirect part of mod_

asp.net - How to add microsoft.sqlserver.smo? -

i trying create new database in webmatrix, , shown error: "could not load file or assembly "microsoft.sqlserver.smo, version=11.0.0.0, culture=neutral, publickeytoken=blablabla" or 1 of dependencies. system cannot find file specified. i sure there error in sql server, not getting anyone. i have searched alot issue. main thing providing solutions visual studio, none of them giving example web.config or should webmatrix, know in vs pretty simple , easy, webmatrix? all came upto somelike in web.config under assemblies, how connect it? or if there, how check whether file on system or not? my question know whether file in system; installed correctly of not, , connect project create new databases. nobody helped guess! tried find answer myself. found on other forums this: that dlls found under folder: c:\program files\microsoft sql server\100\sdk\assemblies and add them in site, using webmatrix require helper; because use webmatrix not visual studio.

sql server - TSQL decision statement -

i have view select number of fields can see. main focus of query though xro_roles.start_page. field holds start page link stored procedure reference. have second table holds links (this table called branches). if dbo.people.role_id = 1 need use branches table start_page column. if role_id not 1 should reference xro_roles.start_page. i not sure how use case statement in scenario. if not giving enough information let me know. thanks select dbo.people.people_id, dbo.people.role_id, dbo.people.company_id, dbo.xro_roles.start_page, dbo.areas.area_id, dbo.areas right outer join dbo.divisions on dbo.areas.area_id = dbo.divisions.area_id right outer join dbo.people left outer join dbo.xro_roles on dbo.people.role_id = dbo.xro_roles.role_id on dbo.divisions.division_id = dbo.people.division_id left outer join dbo.companies on dbo.people.company_id = dbo.companies.company_id left outer join dbo.xro_time_zones on dbo.people.

.net - How do I XML Serialize a object without a parameter-less constructor? -

i trying use application settings feature of visual studios easy save setting of program. 1 of class trying serialize contains number of densematrix objects mathnet.numerics library. densematrix class not have parameter-less constructor when calling my.settings.save() serialization crash. tried replacing matrices double(,) crashed well. tried writing code wrap densematrix follows failed guessing because bases classes have have parameter-less constructors not sure. there logical way store matrices can automatically serialized my.settings.save? <settingsserializeas(settingsserializeas.xml)> public class avtmatrix inherits densematrix public sub new() my.base.new(3,3) end sub end class digging of il, looks uses xmlserializer - in case, answer is: can't - demands public parameterless constructor. can cheat little , though - [obsolete] ; works, example: using system; using system.io; using system.xml.serialization; public class foo { pu

Preventing spam and bots using JavaScript generated checkbox -

i've read 1 can deter bots using js create checkbox in form must set (i.e. http://uxmovement.com/forms/captchas-vs-spambots-why-the-checkbox-captcha-wins/ ). strategy effective? user need physically check box, or can client side js used check well? the article seems fishy me. checkbox captcha seems decent defense against spam bots blindly fill out forms, knowing nothing website happen on, if writing bot has sort of insight page, benefits end there. in end, matters http post. if post can verified server, doesn't matter how post created or script may have run on client. if server looking post value called notabot has value equal 1 , spam bot can include value in own post, server doesn't know if checkbox created through client-side script.. if value must equal random value provided in initial html, spambot can scrape value well. if value must match value provided on image, you've created captcha. in end it's cost/benefit analysis depends on ri

javascript - Setting predefined zoom levels -

i wondering how set predefined zoom levels in arc gis map. ultimate goal if user zooms out past level 5 turn off labels. other wise every thing under level 4 show labels. i've set zoom level 7 , initial load works correctly. when log zoom level console -1 , description of no predefined zoom levels. i'm missing here what, wouldnt log show zoom level of 7 since defined map? function init() { esri.config.defaults.io.proxyurl = webroot + "proxy.ashx "; map = new esri.map("mapdiv", { basemap: "gray", sliderstyle: "large", center: [-95.625, 39.243], nav: false, logo: false, zoom: 7 });//end base map //create feature layer fl = new esri.layers.featurelayer(app.regionmap, { mode: esri.layers.featurelayer.mode_snapshot, outfields: ["fips"], opacity: 0.3, visibile: true });//ends feature layer

javascript - http request from node.js local server port 5000 to 8000 gives error -

i trying make request localhost:8000 localhost:5000 url '/servertest'. socket hang error. how fix this? server on port 5000 (server process request): var express = require("express"), http = require('http'); app.get('/servertest', function(req, res){ //authenticate request //send message res.writehead(200, {'content-type':'application/json'}); res.end(json.stringify({message:'hello'})); }); app.listen(5000, function() { console.log("listening on " + port); }); server on port 8000 (server makes request): var express = require("express"), http = require('http'); var port = 8000; app.listen(port, function() { console.log("listening on " + port); makeacall(); }); function makeacall(){ var options = { host:'localhost', port: 5000, path: '/servertest', method: 'get' }; http.request(optio

java - Animated GIF in Splashscreen -

i have jar file generated ant script following code in it: <manifest> <attribute name="main-class" value="org.epistasis.exstracs.main"/> <attribute name="class-path" value="."/> <attribute name="splashscreen-image" value="logo_anim.gif"/> </manifest> <!--some code--> <zipfileset dir="." includes="logo.png"/> <zipfileset dir="." includes="logo_anim.gif"/> <zipfileset dir="." includes="icon.png"/> when run jar file, no splash screen generated. verified gif in file opening favorite archive manager. loaded gif code , displayed it. however, won't load splashscreen. (no splashscreen displayed, splashscreen.getsplashscreen() returns null ) if replace <attribute name="splashscreen-image" value="logo_anim.gif"/> with <attribute name="splashscreen-image" va

Is there a version control feature in Oracle BI Answers for a single Analysis? -

Image
i built analysis displayed results, error free. well. then, added filters existing criteria sets. copied existing criteria set, pasted it, , modified it's filters. when try display results, see view display error. i’d revert earlier functional version of analyses, without manually undoing of filter & criteria changes made since then. if you’ve seen feature this, i’d hear it! micah- great question. there many times in past when wished had simple scm on oracle bi web catalog. there no "out of box" source control web catalog, simple work-arounds exist. if have access server side web catalog lives can start following approach. oracle bi web catalog version control using git server side cron job: make backup of web catalog! create git repository in web cat base directory root dir , root.atr file exist. initial commit eveything. ( git add -a; git commit -a -m "initial commit"; git push ) setup cron job run script hourly, minu

lxc - What is the impact of using multiple Base Images in Docker? -

Image
i understand docker containers portable between docker hosts, confused relationship base image , host. from documentation on images , appears have heavier footprint (akin multiple vms) on host machine if had variety of base images running. assumption correct? good : many containers sharing single base image. bad : many containers running separate/unique base images. i'm sure lot of confusion comes lack of knowledge of lxc. i confused relationship base image , host. the relation between container , host use same kernel. programs running in docker can't see host filesystem @ all, own filesystem. it appears have heavier footprint (akin multiple vms) on host machine if had variety of base images running. assumption correct? no. ubuntu base image 150mb. you'd hard-pressed use of programs , libraries. need small subset particular purpose. in fact, if container running memcache, copy 3 or 4 libraries needs, , 1mb. there's no need shell,

lua - How to check the value of a boolean (set by user) with a variable string? -

the user sets boolean true or false. that (exemple) elementnameone = true elementnametwo = false elementnamethree = true etc. now have string loaded file. string called name can have values nameone, nametwo, namethree, etc. of them @ time. able this if element .. name == true except don't know how properly. i've tried do if not not ("element" .. name) but not work. can ? thanks try this: if _g["element" .. name] == true -- end note work if variables set user ( elementnameone , .. etc.) globals.

networking - How to open a page when connected to a network -

i have created network in office @ work , share file connected network , wondering if possible make when opens web browser on network automatically opens html document kept in share directory. on page going have few links, emails, accounting, website, facebook etc. actual page not have except links. in theory, long can browse file on shared drive in web browser, should able set home page in web browser loads up.

c# - SelectMany() Cannot Infer Type Argument -- Why Not? -

i have employee table , office table. these joined in many-to-many relationship via employeeoffices table. i'd list of offices particular employee ( currentemployee ) associated with. i thought this: foreach (var office in currentemployee.employeeoffices.selectmany(eo => eo.office)) ; but gives me error: the type arguments method 'system.linq.enumerable.selectmany(system.collections.generic.ienumerable, system.func>)' cannot inferred usage. try specifying type arguments explicitly. i understand add type arguments. intellisense recognizes eo.office of type office. why isn't clear compiler? the type returned delegate pass selectmany must ienumerable<tresult> , evidently, office doesn't implement interface. looks you've confused selectmany simple select method. selectmany flattening multiple sets new set. select one-to-one mapping each element in source set new set. i think want: foreach (var office in

java - Amazon Simple Workflow - Given workflowID List all executions -

workflow when started again, same workflowid, gets different runid. there way retrieve such executions(containing different runid) of given workflow id? i explored listclosedworkflowexecutionsrequest api lists workflow executions, not particular workflowid. problem trying solve is: there many workflows failed reason. in restarting process, didn't include correct time filter , few of them restarted while few got skipped. trying is, list failed workflow ids using listclosedworkflowexecutionsrequest . each workflowid, fetch executions , if latest of them successful, skip else restart. i little new swf there better way accomplish same? thanks yes, possible filter workflowid described in how state of workflowexecution if have workflowid in amazon swf . the answer on line [7] , [9] in example, executions() method call. use case though, since want closed executions, you'll alter method call include closed=true . so, in order closed executions in 24hours (the

node.js - Handling saves and redirects asynchronously in node js and mongoose -

i new node.js , trying understand asynchronous nature of how stuff works. ok simple form submission.the model looks below:- var mongoose=require('mongoose'); var schema=mongoose.schema; var postschema=new schema({ title:{type:string,required:true}, post:string, }); var postmodel=mongoose.model('blogpost',postschema); module.exports=postmodel; and route handler below:- app.post("/submitpost",function(req,res){ var title=req.body.title; var post=req.body.post; var thepost=new postmodel({title:title,post:post}); thepost.save(function(err,data){ if(err)throw err; console.log(data); }) console.log("title "+title); console.log("post "+post); res.send("saved"); }); now suppose validation fails during "thepost.save(callback)" , want show error page rather "saved" . how that? simply move rendering of response callback:

Twitter Bootstrap 3 icon displaying a square -

font files in right place , html code charset utf-8. thats code: <!doctype html> <html> <head> <meta chaset="utf-8"> <title>teste icone</title> <link rel="stylesheet" type="text/css" href="css/bootstrap.css"> </head> <body> <button type="button" class="btn btn-default btn-lg"> <span class="glyphicon glyphicon-star"></span> star </button> </body> </html> and thats file structure: -css *bootstrap.min.css -fonts *all font files here *index.html the strange when on debug font files loaded correctly try re-downloading fonts, may corrupt. check md5 md5 (glyphicons-halflings-regular.eot) = 2469ccfe446daa49d5c1446732d1436d md5 (glyphicons-halflings-regular.svg) = 3b31e1de93290779334c84c9b07c6eed md5 (glyphicons-halflings-regular.ttf) = aa9c7490c2fd52cb96c729753cc4f2d5 md5 (

php - I want to compare values from one array with values of another array -

after search, script riches folder , read each individual file , if found h1 put each word of in array $h1words problem is, want compare 2 arrays $words , $h1words , if there 1 similar character, show h1 if (isset($_get["sub"]) && $_get["sub"]=="search"){ // open known directory, , proceed read contents $dir="c1/cat1/"; $words=explode(" ",$_get["search"]); if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if ($file=="" or $file=="." or $file==".." or $file=="index.php" or $file=="index.html") { continue; } $filet=$dir.$file; if (is_readable($filet)){ $filee=fopen($filet,"r"); while(!feof($filee)){ $str=strip_tags(fgets($filee),&

uml - Can I split system use case diagram into smaller pieces? -

i have system can split modules: user, announcements, stories, meetings , news. each module has 6 use cases. can make 1 diagram per each module? if yes, differ in way all-in-one-diagram? and, should make diagram modules represented in it? i found out "package" concept. if understood right, can use them modules. , then, on primary use case diagram, put packages associations actors. each package has own use cases diagram same actors got whole application model. right? "modules" a, b, c , actors 1, 2 - have 1 diagram packages a, b, c , 1, 2 actors, , 3 use case diagrams respectively a, b, c packages , , actors (like, actor 1 uses package a, not b, c, doesn't appear on them. yes can diagram each module , these diagrams might different all-in-one diagram. main difference between these possible diagram context of diagram. if made diagram "users" module, latter contain several uses cases associated actor(s). definition actors outside our sys

c# - Can i combine two or more different events for one method? -

i'm using filesystemwatcher . it's easy when combining events same type, here ( filesystemeventargs ), , saw passing parameters event handler, passing event event method, don't know how. before, want this: private void systemwatch(object sender, system.io.renamedeventargs e, system.io.filesystemeventargs f) but can't change filesystemeventhandler or renamedeventhandler delegate, there alternative way ? delegates, found in events, define method signature expected called. such, events differing signatures cannot implicitly call method differing signature. one potential workaround might use dynamic lambda method perform translation: watcher.created += (s, a) => systemwatch(s, null, a); watcher.renamed += (s, a) => systemwatch(s, a, null); edit: after further consideration, mcgarnagle stated, renamedeventsargs inherits filesystemeventargs . should able handle both scenarios using sin

javascript - Create frame for dynamically created slide using CSS and Jquery -

for more info, please see jsfiddle . i have create dynamic slides of div's. here's html: <div id="container"> <div id="box1" class="box">div #1</div> <div id="box2" class="box">div #2</div> <div id="box3" class="box">div #3</div> <div id="box4" class="box">div #4</div> <div id="box5" class="box">div #5</div> </div> and js code is: $('.box').click(function() { $(this).animate({ left: '-50%' }, 500, function() { $(this).css('left', '150%'); $(this).appendto('#container'); }); $(this).next().animate({ left: '50%' }, 500); }); and css: body { padding: 0px; } #container { position: absolute; margin: 0px; padding: 0px; width: 100%; heigh

OpenGL: Error moving object using keyboard -

i'm new opengl , i'm trying paint stickman , move using arrow-keys keyboard. idea use global variables stickman , change them when key pressed. afterwards draw-function (mydisplay()) called again. unfortunately following error-message: "error 10 error c2371: 'mydisplay' : redefinition; different basic types " when replace mydisplay()-call in keyboard-function glutpostredisplay() suggested in tutorials read error message disapears , build successful. stickman doesn't move when pressing keys. here's code: #include <gl/glut.h> glint x; glint y; glint d; //parameters stickman void mykeyboard(unsigned char key, int mx, int my) { int x1 = mx; int y1 = 480 - my; switch(key){ case glut_key_left : x = x-50; mydisplay(); break; case 'e' : exit(-1); break; default: break; } } void stickman () { glbegin(gl_lines); //body glvertex2i(x,

java - The method is undefined for the type in Eclipse -

method undefined type in eclipse. can't seem solve it. error in lines: msg.settimestamp( system.currenttimemillis() ); , msg.setbody("this test sms message"); package com.example.smsnotification; import android.app.activity; import android.app.alertdialog; import android.app.alertdialog.builder; import android.content.dialoginterface; import android.content.intent; import android.os.bundle; public class popsmsactivity extends activity{ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //retrieve serializable sms message object key "msg" used pass intent in = this.getintent(); popmessage msg = (popmessage) in.getserializableextra("msg"); //case launch app test ui eg: no incoming sms if(msg==null){ msg = new popmessage(); con.setphone("0123456789"); msg.settimestamp( system.c

user interface - Android fragment optimization -

i trying develop master-child page concept using master-detail flow of android comes execution , design vulnerable critics poor performance. please tell me guidelines increase performance besudes loading bitmaps options ? the below code fragment import java.util.arraylist; import java.util.list; import com.aaa.demo.asynctask.resubmitorder; import com.aaa.demo.util.*; import android.os.bundle; import android.content.context; import android.database.cursor; import android.support.v4.app.*; import android.util.log; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.gridview; import android.widget.imageview; public class moreactivity extends fragment { private bundle parameter; private filemanager fileman; private salesorderretransmitdbadapter sodbretransmithelper; public class recordadapter extends baseadapter { context context; private

version control - Revert local changes in fossil -

how clean/revert/undo local, un-commited changes in single source file fossil? the clean command looks me should trick, no, local changes still there. looking same effect "git checkout filename.c" have. fossil revert <filename> . >fossil revert usage: fossil revert ?-r revision? ?file ...? revert current repository version of file, or version associated baseline revision if -r flag appears. if file part of rename operation, both original file , renamed file reverted. revert files if no file name provided. if file reverted accidently, can restored using "fossil undo" command. options: -r revision revert given file(s) given revision see also: redo, undo, update

How to change the font size of contents in netbeans navigator window -

i want change font size of netbeans navigator window. can change font of editor window using tools\options\fonts & colors. reflected in editor , not in other windows projects, navigator, output, debug. how change font everywhere in netbeans 7.0

windows - How can I open command line prompt from Sublime in windows7 -

Image
i'v created function in vim named opencmd(), used open command line or terminal in vim (and cd in current file path) func! opencmd() if has('win32') let com = '!cmd /c start cd '. expand('%:p:h') else let com = '!/usr/bin/gnome-terminal --working-directory=' . expand('%:p:h') endif silent execute com endfunc nmap cmd :call opencmd() now, want open command line , cd in current file path in sublime (sublime 3 beta). function same opencmd() . and searched question in stackover flow: sublime text 2 - open cmd prompt @ current or project directory (windows) i did the first guy answered (create cmd, cmd.py , context.sublime-menu). cannot work, cmd operation disabled. is there way can it? in advance! the answer sublime text 2 - open cmd prompt @ current or project directory (windows) correct. only 1 step (for me) has changed file name should uppercase . use cmd instead of cmd . my step

sql - Scope_Identity in Stored Procedure -

i have stored procedure has 3 insert statements. need after each insert want know inserted value of id querying scope_identity . something following : insert t1(name)values("david") set @v1=scope_identity() insert t2(name)values("david2") set @v2=scope_identity() insert t3(name)values("david3") set @v4=scope_identity() is there way that? create table t1 (id int identity, name varchar(30)) create table t2 (id int identity, name varchar(30)) declare @v1 int, @v2 int insert t1 (name) values ('david') set @v1 = scope_identity() insert t2 (name) values ('david2') set @v2 = scope_identity() select @v1, @v2 click here see in action @ sql fiddle.

Bootstrap 3 Multiple Nav bar Menus -

i using bootstrap 3's example menu page site: http://getbootstrap.com/examples/jumbotron/ when shrink page menu @ top collapses single drop down list. on page have 2 menues @ top left , right when shrink page don't 2 drop down menues. i when shrink page 2 collapsed menues. possible? try this: http://bootply.com/79216 add button (different) target align second menu right navbar-right , add css reset float , display of navbars. html <nav class="navbar navbar-inverse" role="navigation"> <!-- brand , toggle grouped better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span&g

asp.net - filtering data from a csv file and storing it in a mysql database using vb.net -

i new intern , new .net , have been given task of filtering data csv file , save microsoft sql server susing vb.net,so far haven't seen straightforward answer,anyone can help?...,thanks in advance you can import csv sql-server directly via bulk insert . if need/want use .net can use csv-reader this read csv-file. can use sqlbulkcopy import database efficiently. here article it: http://www.codeproject.com/articles/439843/handling-bulk-data-insert-from-csv-to-sql-server vb.net: using conn = new sqlconnection(connectionstring) conn.open() dim transaction sqltransaction = conn.begintransaction() try using file new streamreader(filename) dim csv new csvreader(file, true, "|"c) ' change separator ' dim copy new sqlbulkcopy(conn, sqlbulkcopyoptions.keepidentity, transaction) copy.destinationtablename = tablename copy.writetoserver(csv) transaction.commit() end

linux kernel - dmesg is not showing printk statement -

i'm trying create proc entry. init_module function below int init_module() { printk(kern_info "proc2:module loaded\n"); proc_entry=proc_create_data(proc_name,0644,null,&fops,null); if(proc_entry==null) { printk(kern_info "proc2:error registering proc entry"); } else { printk(kern_info "proc2:proc entry created"); } return 0; } following cleanup method void cleanup_module() { printk(kern_info "proc2:module unloaded"); remove_proc_entry(proc_name,proc_entry); } rest of program include variable definition , callback functions. when compile program compiles well. when use insmod doesn't reply me prompt. lsmod lists module , shows used 1 (don't know what). dmesg shows none of above printk messages. can tell me what's wrong here? try echo "7" > /proc/sys/kernel/printk enable console log levels. the numbers corresponding below: #define kern_emerg "<0>" /* system un

c++ - Is setting pointer to null an allocated memory? -

i reading code initializes pointer null, thought code not allocating new memory pointer storing 2d array of values (which does) made me wonder, pointer initialized null pointer allocated memory? class int8_tset : public gridset { public: int8_t** set; // // int8_tset():set(0) {} int8_tset( const int8_tset& x ):set(0) {copy(x);} virtual ~int8_tset() { free2darray(set);} // // --- opeartor int8_t operator() ( intvector2d x ) const {return set[x.i][x.j];} int8_t& operator() ( intvector2d x ) {return set[x.i][x.j];} // --- function void set(); void set(int8_t val); void set( intvector2d x ){ ns_griddata::set(x,*this,(int8_t)-1); } void set( intvector2d x,int8_t val){ ns_griddata::set(x,*this,val); } void switch(); // --- output & input void output(std::ostream& out ) const; void input (std::istream& in ); // --- copy & substitute public: void copy( const int8_tset& x ) {ns_griddata::copy(*this,x,(int8_t) -1);} const int8_tse

perl chdir not working, not changing the directory -

my complete perl script chdir ("/etc" or die "cannot change: $!\n"); print "\ncurrent directory $env{pwd} \n"; and getting output (not expected) bash-3.2$ perl test.pl current directory /home p.s. /home executing test.pl you should move or die outside of chdir(...) , i.e.: chdir("/etc") or die "cannot change: $!\n"; with have currently, expression "/etc" or die "cannot change: $!\n" evaluated first. result "/etc" , die() never gets executed. or die() should "applied to" chdir() call, not argument. do print(cwd); print current working directory. don't forget use cwd; use cwd; chdir("/etc") or die "cannot change: $!\n"; print(cwd);