Posts

Showing posts from September, 2012

javascript - jQuery: Remove a function call -

i have function plugin looking … $('.parallax-sections').parallax(); i want function responsing in onresize event , applied window larger 700px. $(window).on("resize", function (e) { if ($(window).width() < 700) { // remove or disable function again ??? //$('.parallax-sections').parallax(); } else { $('.parallax-sections').parallax(); } }); you can disable , enable it. $('.parallax-sections').parallax(); $(window).on("resize", function(e) { if ($(window).width() < 700) { $('.parallax-sections').parallax('disable'); } else { $('.parallax-sections').parallax('enable'); } }); docs

java - Log4j nosql appender Failed to authenticate against MongoDB server -

i'm trying use apache log4j nosql appender . i've configured connect mongodb instance, seem getting authentication error when running project maven install: error failed authenticate against mongodb server. unknown error. i using mongodb 3.0.4 , have created following user with: use test db.createuser({ user:"loguser", pwd:"pwd", roles:["readwrite","dbadmin"] }) and checked can connect using: mongo -u loguser -p pwd my log4j2.xml: <?xml version="1.0" encoding="utf-8"?> <configuration status="debug"> <appenders> <nosql name="databaseappender"> <mongodb databasename="test" collectionname="logging" server = "localhost" port="27017" username = "loguser" password = "pwd"/> </nosql> </appenders> <loggers> <r

database - insert statement show 1 row created but data is not insert (script) -

Image
i using run sql command line insert data, script ask below. insert usermaster (userid,userpwd,username,userposition,useraccessrights,userstatus,createuserid) values ('admin','nvzfj0sojj/efu700exl6a==','admin','administrator','non-administrator','1', 'admin'); but when open database using toad , log in user , see, data not insert table. may know place goes wrong? image below output in sql command. what commit. autocommit on? or add 'commit' after insert statement

java - Querying CLOB column with hibernate criteria -

i have table like table name: items columns : name type id number status varchar2 data clob i have hibernate mapping below @entity @table(name="items", uniqueconstraints = {@uniqueconstraint(columnnames={"id"})}) public class hitem implements serializable { private long id; private string status; private string datajson; @column(name = "id") public long getid() { return id; } @column(name = "status") public string getstatus() { return status; } @column(name = "data") public string getdatajson() { return datajson; } } and querying data using criteria follows list<hitem> items = helper.getsession().createcriteria(hitem.class) .add(restrictions.eq("status", "a")).list(); since have more 1200 matching records in table, throwing jdbc batch update error. suspect due large number

java - How to upload files to server using JSP/Servlet? -

how can upload files server using jsp/servlet? tried this: <form action="upload" method="post"> <input type="text" name="description" /> <input type="file" name="file" /> <input type="submit" /> </form> however, file name, not file content. when add enctype="multipart/form-data" <form> , request.getparameter() returns null . during research stumbled upon apache common fileupload . tried this: fileitemfactory factory = new diskfileitemfactory(); servletfileupload upload = new servletfileupload(factory); list items = upload.parserequest(request); // line died. unfortunately, servlet threw exception without clear message , cause. here stacktrace: severe: servlet.service() servlet uploadservlet threw exception javax.servlet.servletexception: servlet execution threw exception @ org.apache.catalina.core.applicationfilterchain.internaldofilter(

javascript - PHP - Show special characters -

snippet allow user input //fetch user input , pass in url alertify.prompt("please enter note/remarks form (optional):", function (e,value) { if (e) { alertify.success("form has been submitted"); $.post(site_url+"somecontroller/someaction",$("#frm_submit").serialize()+ "&user_id="+user_id+"&comment="+value, function( data ) { }); }else{ alertify.error("your form not submitted"); } }); user input: my project google r&d every googler when form post input not complete , shows below echo $_post['comment'] prints my project google r here if user inputs special characters & in comment, breaks input tried using htmlentities($_post['comment']) , htmlspecialchars($_post['comment'], ent_quotes, 'utf-8') not working. how allow user input special characters ? p.s : not s

Access to a ressource in Android application -

i have tried use gpuimage android. issue not related gpuimage happens @ moment. i'm trying build image filter using image overlay on original image. gpuimagecolordodgeblendfilter tmp = new gpuimagecolordodgeblendfilter(); tmp.setbitmap(bitmapfactory.decoderesource(context.getresources(), r.drawable.hipster)); my issue need access file called hipster.png located in res/drawable/hipster.png i avoid using decoderesource because image same , i'm want avoid using context filter class builtin inside lib aar , reuse in app. any idea ? i have tried use context coming activity it's crashing , think context useless in case thanks hi seb tell how it. difference use context, pass parameter in parts of code , don't have problem. getresources().getidentifier(<nameofimage>, "drawable", getpackagename()) hope helps!

c# - Updating dynamically generated assembly -

i have following code dynamically generates assembly , classes based on edmmodel. working fine, bit confused on how can update assembly when model changes. here current thoughts, either: update current classes, adding/removing properties. adding new classes when needed. create version of assembly, allowing me have 2 versions running @ same time (this approach preferable allow user access different versions of model, , mean current version still used while new 1 being generated) is possible run 2 versions of same assembly way? possible update type has been created? doing right? public class dynamicassembygenerator { private idictionary<string, assemblybuilder> _assemblybuilders; private idictionary<string, modulebuilder> _modulebuilders; private idictionary<string, typebuilder> _typebuilders; private idictionary<string, enumbuilder> _enumbuilders; private idictionary<string, type> _types; public void create(iedmmodel

java - Amazon S3 issue in web applications running in localhost -

please have @ below code. /* * change license header, choose license headers in project properties. * change template file, choose tools | templates * , open template in editor. */ package s3test; import com.amazonaws.auth.awscredentials; import com.amazonaws.auth.basicawscredentials; import com.amazonaws.services.s3.amazons3; import com.amazonaws.services.s3.amazons3client; import java.io.ioexception; import java.io.printwriter; import javax.servlet.servletexception; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; /** * * @author yohan */ public class s3test extends httpservlet { /** * processes requests both http <code>get</code> , <code>post</code> * methods. * * @param request servlet request * @param response servlet response * @throws servletexception if servlet-specific error occurs * @throws ioexception if i/o er

Checking NULL in C# LINQ expression -

i have linq expression converts dateformat utc date format of user culture. for (int = 0; < datexml.count ; i++) { if (datatype.tolower() == "date") { mylist.select(c => { ((object[])(c))[i] = convertfromutcdate( convert.todatetime (((object[])(c))[i]), usertimezone); return c; }).tolist(); } } some times date value in (object[])(c))[i] null or have string or decimal if value wrongly stored in db. how check if values not null , has date , convert in expression. to avoid adding more complexity , being able read , maintain code easily, extract anonymous method , make named method from c => { ((object[])(c))[i] = convertfromutcdate( convert.todatetime (((object[])(c))[i]), usertimezone); return c; } to public datetime convertfromobjecttodate(object dbdate){ if(dbdate null || !(dbdate datetime))return datetime.minvalue; var result = convertfromutcdate(convert.todatetime (dbdate),usertimezone);

asp.net mvc - Can I use Sass(css preprocessor) in Visual Studio Express 2013 for web? -

Image
if yes how because mindscape web workbench , sassystudio (free plug-in) tool not support in vs express free version and how compile scss css done install-package sassandcoffee i got solution first add via nuget console install-package sassandcoffee and in page.cshtml page <link href="~/content/sassdemo.css?@viewbag.id" rel="stylesheet" type="text/css" /> viewbag.id no need clear cache of browser every time controller code public actionresult index() { viewbag.id = datetime.now.tostring("yyyymmddhhmmss"); return view(); } now run , change variable values colors u see effect in css sassdemo.scss $color: red; .a{ width: 100%; } .maindiv { @extend .a; /*extend/inheritance */ /*width: 100%;*/ border: 1px solid $color; height: 200px; padding: 10px; margin-top: 10px; } .childdiv {

html - Truncate word that comes before hyphen in jQuery -

i curious how truncate word comes before hyphen in word, example: [jazz] - 1970's blues would become... the 1970's blues i know how in php , there many functions make possible in php... curious how work jquery! you can try following: var text="[jazz] - 1970's blues"; alert(text.substring(text.indexof("-")+1));

android - Add ImageView after text -

Image
i want achieve functionality. please provide suggestion it. try this, adds drawable in textview after text. textview text=(textview)findviewbyid(r.id.textview); spannablestringbuilder builder = new spannablestringbuilder(); builder.append("this text image!").append(" "); drawable myicon = getresources().getdrawable(r.drawable.ic_new); myicon.setbounds(0, 0, test.getlineheight(),test.getlineheight()); builder.setspan(new imagespan(myicon, imagespan.align_baseline),builder.length() - 1, builder.length(), 0); text.settext(builder);

multithreading - Error in Sending a mp3 files using Python -

i trying send mp3 files through python. here following code - for v in videos: thread(target=video_download, args=(handler,v,videos)).start() def video_download(handler,v,videos): try: ydl_opts['format'] = 'mp4' ydl(ydl_opts).download([v]) except: ydl_opts['format'] = 'best' ydl(ydl_opts).download([v]) mp3 = open('./'+v+'.mp3', "r+").read() handler.send_header('content-disposition', 'attachment; filename=%s.mp3' % videos[v]) handler.wfile.write(mp3) handler.end_headers() it downloads m4a format video youtube , converts mp3 files. download , conversion part working perfectly, uses threading, while sending file using wfile.write() receive following error traceback (most recent call last): file "/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run()

Facebook app-scoped id digits only? -

is facebook app-scoped id digits only? im working on able login username or fb-login, , im planning store username , fb-id in same column login, if facebook app-scoped id digits only, force usernames @ least contains 1 alphabet avoid duplication , inteference app-scoped id according the docs , facebook id "numeric string". seems indicate indeed contain digits. personally, i've never seen other digits, , although it's theoretically possible api change in future, it's unlikely change particular thing. so, plan should work.

java - How to Set the Background Color Behind a .png Background in Android -

so have set of .png pictures have transparent background on checkerboard. when playing piece clicked, possible places piece can move change color. however, want know if in setting background color of tile , if tile has opposing piece on it, picture of opposing piece overridden , erased in favor of color. , if erased, how can avoid problem? this call used set background .png file btn.setbackgroundresource(r.drawable.filename); this call used set background color btn.setbackgroundcolor(color.color);

php - how can create categories with different options of it in mysql tables -

i want design database mysql categories options categories example : script classified .. when want add ads in "cars category" must add options car . when add ads in "apartments sale category" must add options apartment or @ image dubizzle site classified when want add car in "cars category" show options http://i.stack.imgur.com/gkgl8.png and when want add ads in "apartments sale category" show options http://i.stack.imgur.com/dtnzi.png how can design database such ?? categories , sub-categories different options categories create table category ( id int auto_increment primary key, catname varchar(100) not null ); create table catoption ( -- no attempt share option across multiple categories id int auto_increment primary key, catid int not null, descr varchar(100) not null, listingorder int not null -- order listed on screen -- include fk category ); create table listing ( id int a

image - Android Webview load local content with picture resize -

i have got html content interface , show in webview,but pics large , small,how should make big pics fits screen , keep small pics' size? here script : if (android.os.build.version.sdk_int >= 19) { // 设置图片自适应(4.4以上安卓版本) document doc_dis = jsoup.parse(content); elements ele_img = doc_dis.getelementsbytag("img"); if (ele_img.size() != 0) { for (element e_img : ele_img) { //if(e_img.) e_img.attr("style", "width:100%"); } } string newhtmlcontent = doc_dis.tostring(); webview.loaddatawithbaseurl( com.sns.cangmin.sociax.api.api.gethost(), newhtmlcontent, "text/html", "utf-8", null); } else { // 设置图片自适应(不适合4.4以上安卓版本) websetting.setlayoutalgorithm(layoutalgorithm.single_column); websetting.setbuiltinzoomcontrols(true); // 设置显示缩放按钮 websetting.setsupportzoom(true); // 支持缩放 webview.loaddatawithbaseurl( com.sns.cangmin.sociax.api.api.get

rust - What is the best pattern for working with regex results? -

i javascript dev looking game rust. i've read the rust programming language , completed tutorials, , added rust node project using ffi. speed parser wrote think i'm missing fundamental ownership concept. the current challenge simple: evaluate regex named capture , change value of variable new captured value. i've tried fifteen ways using unwrap or nesting result s , option s. comes down 'does not live long enough' error. my recent code looks this: let flag_re = compile_re(r"(?:\s*)([~])(?:\s*)(?p<flag>.)"); let mut flag : &str = "v"; line in file.lines() { let mut current_line : string = line.unwrap(); if flag_re.is_match(&current_line) { let new_flag = &flag_re.captures(&current_line).unwrap().name("flag").unwrap().clone(); println!("old flag: {} new flag: {}",flag,new_flag); flag = new_flag; } this works great if comment out flag = new_fla

php - CakePHP error "Model is not associated with model..." -

i having trouble cakephp the agent model: agent.php class agent extends appmodel{ var $name = 'agent'; var $belongsto = array( 'arrival'=>array( 'classname'=>'airtime', 'foreignkey'=>'arrival_id' ), 'departure'=>array( 'classname'=>'airtime', 'foreignkey'=>'departure_id' )); } the airtime model: airtime.php class airtime extends appmodel{ var $name = 'airtime'; } controller: agentcontroller.php $condition = array( 'limit'=>20, 'contain'=>array( 'arrival'=>array( 'fields'=>array('airline_id','flight_num'), 'airline'=>array('fields'=>'code') ), 'departure'=>array(

cuda - Does Alea GPU allow keeping LLVM IR code in the compilation chain? -

nvidia not allow access generated llvm ir in compilation flow of gpu kernel written in cuda c/c++. know if possible if use alea gpu? in other words, alea gpu compilation procedure allows keeping generated optimized/unoptimized llvm ir code? yes, right, nvidia doesnot show llvm ir, can ptx code. while alea gpu allows access llvm ir in several ways: method 1 you use workflow-based method code gpu module template, compile template llvm ir module, link llvm irmodule, optionally other ir modules, ptx module. finally, load ptx module gpu worker. while llvm irmodule, can call method dump() print ir code console. or can bitcode byte[] . i suggest read more details here: workflow-based gpu coding workflows in detail the f# this: let template = cuda { // define kernel functions or other gpu moudle stuff let! kernel = <@ fun .... @> |> compiler.definekernel // return entry pointer module, // main() function c program return entry(fun pr

jquery - Javascript wont update div rails 4 -

hello rails 4 newbie here. cant seem ajax update view. @ loss. can alert pop when click +1 link in view can't view update (show votes) span id="ajaxed", though database updating. have read rails guides on ajax , @ 6 videos on youtube on how , seems right me doesn't work me. here html: <tbody> <% @topics.each |topic| %> <tr> <td><%= topic.title %></td> <td><%= topic.description %></td> <td><span id="ajaxed"><%=pluralize(topic.votes.count, "vote")%></span></td> <td><%= link_to "+1", upvote_topic_path(topic), id: "upvote", remote: true, method: :post%></td> <td><%= pluralize(topic.downvotes.count, "downvote") %></td> <td><%= link_to "-1", downvote_topic_path(topic), method: :post %></td> <td><%= link_to 'show', topic %&

Emulate a SQL LIKE search with ElasticSearch -

i'm beginning elasticsearch , trying implement autocomplete feature based on it. i have autocomplete index field city of type string . here's example of document stored index: { "_index":"autocomplete_1435797593949", "_type":"listing", "_id":"40716", "_source":{ "city":"rome", "tags":[ "listings" ] } } the analyse configuration looks this: { "analyzer":{ "autocomplete_term":{ "tokenizer":"autocomplete_edge", "filter":[ "lowercase" ] }, "autocomplete_search":{ "tokenizer":"keyword", "filter":[ "lowercase" ] } }, "tokenizer":{ "autocomplete_edge":{

java - not able to retrieve string from parse database with query -

i'm trying retrieve information parse object strings store them in keep equaling null. here how saved object // current user parseobject studentclasses = new parseobject("studentclasses"); // register periods database studentclasses.put("student_id", parseuser.getcurrentuser()); studentclasses.put("first_period", classselected_period[period1]); studentclasses.put("second_period", classselected_period[period2]); studentclasses.put("third_period", classselected_period[period3]); studentclasses.put("fourth_period", classselected_period[period4]); studentclasses.put("fifth_period", classselected_period[period5]); studentclasses.put("sixth_period", classselected_period[period6]); studentclasses.put("seventh_period", classselected_period[period7]); // save information database studentcla

sql - Impala Query: Find value in pipe-separated list -

i have column containing rows of pipe separated string values: | cola | ___________ | 5|4|2|255 | | 5|4|4|0 | | 5|4|4|3 | | 5|4|4|4 | i need create query select rows contain 4 or 5, never 2 or 3. along lines of: select t.cola my_table t (t in ("4", "5") , t not in ("2","3") resulting in: | cola | ___________ | 5|4|4|0 | | 5|4|4|4 | i ended using combination of 2 answers below, using either method alone still left me rows containing "255". here's final query: select t.cola my_table t (t.cola in ('4', '5') or t.cola "%|5|%" or t.cola "%|5" or t.cola "5|%") , t.cola not "%3%" , t.cola not "%|2|%" , t.cola not regexp "^2|%" , t.cola not regexp "%|2$" there more elegant way this, trick. what using like function ? where (t '%4%' or t '%5%') , (t not '%2%' , t

Maven cannot find .git (dotGitDirectory) -

i have issue similar has been asked here , there no answer. have following structure in maven project (which standard): parent-pom - parent others |_reactor - concrete project, parent-pom parent |_module_1 - reactor parent |_module_2 ... |_module_n git-commit-id-plugin configured in parent-pom , else. until fine: able build both whole reactor project , modules separately mvn clean install. added new module (let's module_n1), believe build had been going fine until massive merge. got following situation: reactor build successful, each module separately 1 n builds well. module_n1 fails following error: [error] failed execute goal pl.project13.maven:git-commit-id-plugin:2.1.7:revision (default) on project module_n1: .git directory not found! please specify valid [dotgitdirectory] in pom.xml there .git folder under reactor module. experiment removed , same error other modules. what reason why 1 particular module cannot find .git fo

php - Redirect to a subdirectory using htaccess -

i using proxcore in website http://www.enkaizen.es/ . trying install wordpress on subdirectory called "/soporte/" script came out of box .htaccess this: <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^$ app/webroot/ [l] rewriterule (.*) app/webroot/$1 [l] </ifmodule> it not allow visit http://www.enkaizen.es/soporte/ , stays on home page. added rewrite line top .htaccess file this: <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^soporte/?$ soporte/ [l] rewriterule ^$ app/webroot/ [l] rewriterule (.*) app/webroot/$1 [l] </ifmodule> but not working. if take out second , third rewrite lines work, meaning can visit http://www.enkaizen.es/soporte/ , script itself, proxcore script, not work @ all, , need have wordpress installation on "/soporte/" directory. any ideas? please help! for if facing issue, accomplished adding rewrite line: rewriterule ^soporte/

ibm mobilefirst - How to get data from notifications in hybrid app using Worklight and Cordova plugin -

i writing hybrid application ibm mobilefirst 8.5 , cordova plugin , don't know how data notifications. i want create list containing data notifications within app. possible using cordova or ibm mobilefirst? remember possible when used e.g. java on android platform using handler. all tutorials show "how push notification" app didn't find tutorial "how data notification within app". there no such release "mobilefirst 8.5". there's either 6.3 or 7.0... additionally, not send notifications app, receive them in app. tutorials show how handle (display) notifications in app. sample apps accompany tutorials put notification's payload (the text sent via notification) in alert - else you'd it. so example, in hybrid sample app there following code: // handle received notification function pushnotificationreceived(props, payload) { alert("pushnotificationreceived invoked"); alert("props :: " +

python - Animating Text in Matplotlib Basemap -

i plotting 2d array on matplotlib's basemap , animating through time. having trouble adding in time counter. animation starts @ 0 ut , progresses through 23 ut before starting on @ 0ut. animation works beautifully. here code: from netcdf4 import dataset import numpy np import matplotlib.pyplot plt mpl_toolkits.basemap import basemap, addcyclic import matplotlib.animation animation #load netcdf file variable mar120="c:/users/willevo/desktop/my datasets share/sa120_iono_acc_we.nc" #grab data new variable fh=dataset(mar120,mode="r") #assign model variable contents python variables lons=fh.variables['lon'][:] lats=fh.variables['lat'][:] var1=fh.variables['ntd_up'][:] #specifying time , elevation map ionst=var1[0,18,:,:] details='(0ut, z=2)' #close netcdf file fh.close() details='(0ut, z=2)' # rid of white stripe on map ionst, lons=addcyclic(ionst, lons) #setting figure attributes fig=plt.figure(figsize=(12,12),

opengl - What is the difference between a sample, a pixel and a fragment? -

i still can't wrap head around differences there between sample/pixel/fragment. since fragment shader executes per pixel, think fragment refers pixel, correct? can give me example , definition of each one? a pixel screen element. fragment corresponding portion given geometric primitive +- covering pixel. antialiasing (and more) several samples can pickup in pixel. a pixel values mean of samples values, , fragments several triangles might contribute given pixel.

c# - Outlook Interop - MailItem.Sender is Hanging\Freeze -

i use code below msdn link , working in system fetch sender email address. when deploy same code 1 of our dev servers, below line of code hangs\freeze indefinitely without response. after tracing , figured if attribute of sender object accessed it, hangs forever. cache exchange mode turned "on" mail box , running in outlook 2010. have manually downloaded address book outlook din't help. believe not code issue. can 1 help? https://msdn.microsoft.com/en-us/library/office/ff184624.aspx sender.addressentryusertype == outlook.oladdressentryusertype. olexchangeuseraddressentry || sender.addressentryusertype == outlook.oladdressentryusertype. olexchangeremoteuseraddressentry microsoft not recommend, , not support, automation of microsoft office applications unattended, non-interactive client application or component (including asp, asp.net, dcom, , nt services), because office may exhibit unstabl

I want to compare two projects in Android studio -

i have couple android studio projects similar, , want know source files differ. easy way that? right click file/directory/project/module > click compare with > give path compare easy way find path : ( considering both projects open in android studio) switch project want compare > right click file/directory/project/module > copy path > paste in select path dialog. better copy path first. verified : android studio 1.5.1

Hindi characters in url parameter in java -

i working on language identifier need pass text server , identify language i'm trying pass hindi characters through url server.how can pass hindi characters url parameter in java.please me this. you need encode url using urlencoder . use urlencoder.encode method, this: string yourencodedurl = urlencoder.encode(yoururlwithhindicharacters, "utf-8");

sql server - T-SQL Xquery Exist Method return nothing -

i have following xquery piece, i'm trying test outside of t-sql script: declare @x xml select @x = n'<?xml version="1.0" encoding="utf-16"?> <root xmlns="http://www.w3.org"> <header> <record> <a99> <a99_01_0> <a99_01>test</a99_01> <a99_02>test</a99_02> <a99_03>test</a99_03> </a99_01_0> </a99> </record> </header> </root> '; select @x.exist('//header/record/a99/a99_01_0/a99_01') i want check if there value between a99_01 tags, there is. according exist(), output keeps coming 0, indicating doesn't exist. is there i'm missing? i've double checked make sure syntax exist() correct. appreciated! yes - you&

node.js - Returning XML in response from Loopback Remote Method -

i using loopback connector rest (1.9.0) , have remote method returns xml: foo.remotemethod ( "getxml", { accepts: [ {arg: 'id', type: 'string', required: true } ], http: {path: '/:id/content', "verb": 'get'}, returns: {"type": "string", root:true}, rest: {"after": setcontenttype("text/xml") } } ) the response returns escaped json string: "<foo xmlns=\"bar\"/>" instead of <foo xmlns="bar"/> note response have content-type set text/xml. if set accept: header "text/xml", "not acceptable" response. if set "rest": { "normalizehttppath": false, "xml": true } in config.json, 500 error: syntaxerror: unexpected token < i think "xml: true" property causing response

c# - WPF/C#5.0 Publish/Subscribe to an array of static fields? -

using c# 5.0, i'm creating publish/subscribe relationship on static field, can access multiple pages. in host window, have public enum plcstates { good, bad, disabled }; public static class plcsafestates { public static event eventhandler teststates1changed; private static plcstates _teststates1; public static plcstates teststates1 { { return _teststates1; } set { if (value != _teststates1) { _teststates1 = value; if (teststates1changed != null) teststates1changed(null, eventargs.empty); } } } } and in pages hosted window, have things like: public fb1() { initializecomponent(); safteyfaults.plcsafestates.teststates1changed += plcsafestates_teststates1changed; } private void plcsafestates_teststates1changed(object sender,

Another PHP include issue -

i've gone through archives , read bunch of questions relating why php include won't work. i've tried fix problem using answers other questions, still having issues. this code: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>fuel status map</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main"> <div id="map"> <? require 'maplink.php'; ?></div> <div id="title"><img src="title.png" width="400" height="200" /> </div> <div id="links"> <a h

MySQLdb module works when running Python script from the command line, but not as a cron job -

i trying create cron job run python script wrote, reason script runs when i'm running command line. worked before, accidentally deleted crontab. when crontab wrote tries run it, error mysqldb module being wrong architecture: traceback (most recent call last): file "/users/myuser/documents/ee_sfdc integration/csv_reader/weekly_updates/weekly_confirmation/weekly_confirm.py", line 7, in <module> import mysqldb file "/library/python/2.7/site-packages/mysqldb/__init__.py", line 19, in <module> import _mysql importerror: dlopen(/library/python/2.7/site-packages/_mysql.so, 2): no suitable image found. did find: /library/python/2.7/site-packages/_mysql.so: mach-o, wrong architecture in crontab, i've tried using full path several python versions (2.7 , 3.4), still issue. when use 3.4, don't error mysqldb, do error on print .forma() statement being wrong syntax. but again, doesn't happen when run script command li

sql server - There are no primary or candidate keys in the referenced table -

i have 2 tables: table1 c_id float - pk field1 field2 field3 p_id [uniqueidentifier] and table2 p_id nvarchar s_id float where both p_id , s_id part of primary key. i tried create foreign key on table1: alter table table1 add constraint fk_table1_table2 foreign key (p_id) references table2(p_id) and got error: there no primary or candidate keys in referenced table 'dbo.table2' match referencing column list in foreign key 'fk_table1_table2'. am getting error because data type of p_id uniqueidentifier , in table2 p_id nvarchar? there workaround? you have use fk includes same columns in pk create table parenttest ( somenumber int, name varchar(25), primary key (somenumber, name) ) create table childtest ( somevalue varchar(25), somenumber int, name varchar(25), foreign key (somenumber, name) references parenttest (somenumber, name) )