Read File in chunks and then read line by line using LineNumberReader.
Repeat this activity
I have a file containing some 6.5 lakh lines. Now I wish to read every
line of this file using LineNumberReader.
However I am encountering an outofMemoryError on adding these many number
of lines to another 3rd party library..
What I intend to do is, read 200000 lines of a file at a time and add
these lines to 3rd party library.
I am using LineNumberReader but I think the entire file is being read
although I have provided condition that when line count reaches 200000
break the loop and add these to 3rd party library..
A code snippet for the same:
LineNumberReader lnr=new LineNumberReader(new FileReader(file));
String line=null;
int i=0;
while(flags)
{
while( null != (line = lnr.readLine()) ){
i++;
3rdPartyLibrary.add(line.trim());
if(i==200000)
{
System.out.println("Breaking");
lnr.mark(i);
break;
}
if(i==400000)
{
System.out.println("" );
lnr.mark(i);
break;
}
if(i==600000)
{
System.out.println("BREAKING " );
lnr.mark(i);
break;
}
}
if(line==null)
{
System.out.println(" FLAG");
flags=false;
}
lnr.reset();
}
What I am intending to do here is read file from 0-200000 in first
iteration. Then read each individual line and add to 3rd party lib.. Once
this is done, read another 200000 lines from (200001-400000) and then
repeat the same activity.
Need help..Can someone please guide..
Saturday, 31 August 2013
TypeScript: Access static methods within classes (the same or another ones)
TypeScript: Access static methods within classes (the same or another ones)
Suppose we have the following code:
[Test.js file]:
class Test {
...
public static aStaticFunction():void {
...
this.aMemberFunction(); // <- Issue #1.
}
private aMemberFunction():void {
...
this.aStaticFunction(); // <- Issue #2.
}
}
[Another.js file]:
class Another {
...
private anotherMemberFunction():void {
Test.aStaticFunction(); // <- Issue #3.
}
}
See the Issue #x. comments for the issues (3) I want to address.
I've been playing with some configurations by now and I don't get it all yet.
Can you help me to understand how can I access this methods in the three
places?
Thanks.
Suppose we have the following code:
[Test.js file]:
class Test {
...
public static aStaticFunction():void {
...
this.aMemberFunction(); // <- Issue #1.
}
private aMemberFunction():void {
...
this.aStaticFunction(); // <- Issue #2.
}
}
[Another.js file]:
class Another {
...
private anotherMemberFunction():void {
Test.aStaticFunction(); // <- Issue #3.
}
}
See the Issue #x. comments for the issues (3) I want to address.
I've been playing with some configurations by now and I don't get it all yet.
Can you help me to understand how can I access this methods in the three
places?
Thanks.
Structural-type casting does not work with String?
Structural-type casting does not work with String?
Given these definitions:
type HasMkString = { def mkString(sep:String):String }
val name = "John"
val names = List("Peter", "Gabriel")
And given these facts:
name.mkString("-") // => "J-o-h-n"
name.isInstanceOf[HasMkString] // => true
names.isInstanceOf[HasMkString] // => true
While this works:
names.asInstanceOf[HasMkString].mkString("-")
// => Peter-Gabriel
This does not work:
name.asInstanceOf[HasMkString].mkString(", ")
java.lang.NoSuchMethodException: java.lang.String.mkString(java.lang.String)
at java.lang.Class.getMethod(Class.java:1624)
at .reflMethod$Method1(<console>:10)
at .<init>(<console>:10)
at .<clinit>(<console>:10)
at .<init>(<console>:7)
at .<clinit>(<console>)
at $print(<console>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
Why is that? Is it because String is a Java class? Can I work around this
problem? Is this a bug/shortcoming in the Scala implementation?
Given these definitions:
type HasMkString = { def mkString(sep:String):String }
val name = "John"
val names = List("Peter", "Gabriel")
And given these facts:
name.mkString("-") // => "J-o-h-n"
name.isInstanceOf[HasMkString] // => true
names.isInstanceOf[HasMkString] // => true
While this works:
names.asInstanceOf[HasMkString].mkString("-")
// => Peter-Gabriel
This does not work:
name.asInstanceOf[HasMkString].mkString(", ")
java.lang.NoSuchMethodException: java.lang.String.mkString(java.lang.String)
at java.lang.Class.getMethod(Class.java:1624)
at .reflMethod$Method1(<console>:10)
at .<init>(<console>:10)
at .<clinit>(<console>:10)
at .<init>(<console>:7)
at .<clinit>(<console>)
at $print(<console>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
Why is that? Is it because String is a Java class? Can I work around this
problem? Is this a bug/shortcoming in the Scala implementation?
Controller#needs - Route has dot in it?
Controller#needs - Route has dot in it?
I recently had to convert all of my routes to the deeply nested version.
For example: pages.page became books.book.pages.page. It was necessary for
some of the linking I was doing. The problem is that I have a controller
that declares that it needs another controller. Specifically, it needed
the book controller. But now the book controller is the books.book
controller. This presents an issue because this code no longer works:
this.get('controllers.books.book');
Now it thinks that book is just a property of the books controller, when
in reality, it's all one property. How can I resolve this issue? So far
I've tried these methods, none of which work:
this.get('controllers').get('books.book');
this.get('controllers.`books.book`');
this.get("controllers.'books.book'");
I recently had to convert all of my routes to the deeply nested version.
For example: pages.page became books.book.pages.page. It was necessary for
some of the linking I was doing. The problem is that I have a controller
that declares that it needs another controller. Specifically, it needed
the book controller. But now the book controller is the books.book
controller. This presents an issue because this code no longer works:
this.get('controllers.books.book');
Now it thinks that book is just a property of the books controller, when
in reality, it's all one property. How can I resolve this issue? So far
I've tried these methods, none of which work:
this.get('controllers').get('books.book');
this.get('controllers.`books.book`');
this.get("controllers.'books.book'");
Aligning coordinate systems
Aligning coordinate systems
Let's say I have 2 coordinate systems as it is shown in image attached
How can I align this coordinate systems? I know that I need to translate
second coordinate system around X with 180 grads, and then translate it to
(0, 0) of the first coordinate system, but I have some troubles with doing
it getting wrong results. Will really appreciate any detailed answer.
Let's say I have 2 coordinate systems as it is shown in image attached
How can I align this coordinate systems? I know that I need to translate
second coordinate system around X with 180 grads, and then translate it to
(0, 0) of the first coordinate system, but I have some troubles with doing
it getting wrong results. Will really appreciate any detailed answer.
Change Text for loading screen in ActionBar-PullToRefresh library
Change Text for loading screen in ActionBar-PullToRefresh library
I have successfully implemented ActionBar-PullToRefresh in my code. Now
whenever I refresh the list it shows "Loading ..." text in ActionBar.
So how to change that text in ActionBar. Do I directly change the string
in the library or is there any other way to do that...
I have successfully implemented ActionBar-PullToRefresh in my code. Now
whenever I refresh the list it shows "Loading ..." text in ActionBar.
So how to change that text in ActionBar. Do I directly change the string
in the library or is there any other way to do that...
Friday, 30 August 2013
Java Regex replaceAll() with lookahead
Java Regex replaceAll() with lookahead
I am fairly new to using regex with java. My motive is to escape all
occurrences of '*' with a back slash. This was the statement that I tried:
String replacementStr= str.replaceAll("(?=\\[*])", "\\\\");
This does not seem to work though. After some amount of tinkering, found
out that this works though.
String replacementStr= str.replaceAll("(?=[]\\[*])", "\\\\");
Based on what I know of regular expressions, I thought '[]' represents an
empty character class. Am I missing something here? Can someone please
help me understand this?
I am fairly new to using regex with java. My motive is to escape all
occurrences of '*' with a back slash. This was the statement that I tried:
String replacementStr= str.replaceAll("(?=\\[*])", "\\\\");
This does not seem to work though. After some amount of tinkering, found
out that this works though.
String replacementStr= str.replaceAll("(?=[]\\[*])", "\\\\");
Based on what I know of regular expressions, I thought '[]' represents an
empty character class. Am I missing something here? Can someone please
help me understand this?
Wednesday, 28 August 2013
FQL and place locations?
FQL and place locations?
Something I've been playing with is getting address information from FQL
queries. For example, I can get a place, but it doesn't have any of the
location information beyond the lat/lng.
Is there a way that I can get a place and have it include the location
address?
Looking at this page,
https://developers.facebook.com/docs/reference/fql/place - I'm not sure
how this could be done, and scanning the documentation, I can't seem to
find the ability to do so.
Something I've been playing with is getting address information from FQL
queries. For example, I can get a place, but it doesn't have any of the
location information beyond the lat/lng.
Is there a way that I can get a place and have it include the location
address?
Looking at this page,
https://developers.facebook.com/docs/reference/fql/place - I'm not sure
how this could be done, and scanning the documentation, I can't seem to
find the ability to do so.
How to access instance variable from ajax?
How to access instance variable from ajax?
I have a model named User and in its index.html.erb file, has a link which
calls an ajax request responsible for retrieving user's authenticated
radars. There it is:
//user.js
function retrieve_radars() {
$.ajax({
type: "GET",
url: "/radars",
success: function(data) {
console.log(data);
}
});
}
#app/controllers/radars_controllers.rb
def index
user = current_user;
@radars = Radar.where(:user_id => user.id)
@radars
end
How could I iterate @radars instance variable in "users/index.html.erb",
after the success ajax response? I would like to do something like this:
<% unless @radars.nil? %>
<table>
<% @radars.each do |radar| %>
<tr>
<td>Name</td>
<td><%= radar.name %></td>
</tr>
<% end %>
</table>
<% end %>
Any help? Thanks
I have a model named User and in its index.html.erb file, has a link which
calls an ajax request responsible for retrieving user's authenticated
radars. There it is:
//user.js
function retrieve_radars() {
$.ajax({
type: "GET",
url: "/radars",
success: function(data) {
console.log(data);
}
});
}
#app/controllers/radars_controllers.rb
def index
user = current_user;
@radars = Radar.where(:user_id => user.id)
@radars
end
How could I iterate @radars instance variable in "users/index.html.erb",
after the success ajax response? I would like to do something like this:
<% unless @radars.nil? %>
<table>
<% @radars.each do |radar| %>
<tr>
<td>Name</td>
<td><%= radar.name %></td>
</tr>
<% end %>
</table>
<% end %>
Any help? Thanks
Converting Signed byte array content to decimal with shifting in java
Converting Signed byte array content to decimal with shifting in java
I had a byte array with hex decimal values and I converted that array to
decimal values, using the following code
byte[] content = message.getFieldValue( "_Decoder Message" ).data();
int[] decContent = new int[ content.length ];
int i = 0;
for ( byte b : content )
decContent[ i++ ] = b & 0xff;
now the array looks like decContent = [01 00 05 00 00 00] ;
The first 2 indexes of this array is converted and saved as int value as
below
int traceIdlow = decContent[ 0 ] & 0xFF;
int traceIdhigh = decContent[ 1 ] & 0xFF;
int TraceId = traceIdlow | ( traceIdhigh << 8 );
The last 4 indexes needs to be converted to int as well but I am confused
about the shifting whether it should be 8 or 16 .
How can I convert the last 4 indexes to int value so that according to the
above example the value becomes
00 00 00 05 = 5 in decimal.
Any ideas?
Thanks
I had a byte array with hex decimal values and I converted that array to
decimal values, using the following code
byte[] content = message.getFieldValue( "_Decoder Message" ).data();
int[] decContent = new int[ content.length ];
int i = 0;
for ( byte b : content )
decContent[ i++ ] = b & 0xff;
now the array looks like decContent = [01 00 05 00 00 00] ;
The first 2 indexes of this array is converted and saved as int value as
below
int traceIdlow = decContent[ 0 ] & 0xFF;
int traceIdhigh = decContent[ 1 ] & 0xFF;
int TraceId = traceIdlow | ( traceIdhigh << 8 );
The last 4 indexes needs to be converted to int as well but I am confused
about the shifting whether it should be 8 or 16 .
How can I convert the last 4 indexes to int value so that according to the
above example the value becomes
00 00 00 05 = 5 in decimal.
Any ideas?
Thanks
RequestHandler.handleRequest() before UI.init()?
RequestHandler.handleRequest() before UI.init()?
I have Vaadin 7 application. I define vaadin servlet as a session
listener, register it on servletInitialized(), and in sessionInit() I add
request handler using session.addRequestHandler(). Request handler defines
some resources to be used to build components in UI. Components are built
in UI.init().
My problem is the fact that UI.init() is called before
requestHandler.handleRequest(). How can I add request listener which will
be triggered before initializing UI?
I have Vaadin 7 application. I define vaadin servlet as a session
listener, register it on servletInitialized(), and in sessionInit() I add
request handler using session.addRequestHandler(). Request handler defines
some resources to be used to build components in UI. Components are built
in UI.init().
My problem is the fact that UI.init() is called before
requestHandler.handleRequest(). How can I add request listener which will
be triggered before initializing UI?
The variable return null all the time
The variable return null all the time
My program is a webcrawler. Im trying to download images from a website.
In my webcrawler site i did:
try
{
HtmlAgilityPack.HtmlDocument doc =
TimeOut.getHtmlDocumentWebClient(mainUrl, false, "", 0, "", "");
if (doc == null)
{
if (wccfg.downloadcontent == true)
{
retwebcontent.retrieveImages(mainUrl);
}
failed = true;
wccfg.failedUrls++;
failed = false;
}
For example when doc is null the mainUrl contain:
http://members.tripod.com/~VanessaWest/bundybowman2.jpg
Now its jumping to the retrieveImages method in the other class:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using HtmlAgilityPack;
using System.IO;
using System.Text.RegularExpressions;
using System.Xml.Linq;
using System.Net;
using System.Web;
using System.Threading;
using DannyGeneral;
using GatherLinks;
namespace GatherLinks
{
class RetrieveWebContent
{
HtmlAgilityPack.HtmlDocument doc;
string imgg;
int images;
public RetrieveWebContent()
{
images = 0;
}
public List<string> retrieveImages(string address)
{
try
{
doc = new HtmlAgilityPack.HtmlDocument();
System.Net.WebClient wc = new System.Net.WebClient();
List<string> imgList = new List<string>();
doc.Load(wc.OpenRead(address));
HtmlNodeCollection imgs =
doc.DocumentNode.SelectNodes("//img[@src]");
if (imgs == null) return new List<string>();
foreach (HtmlNode img in imgs)
{
if (img.Attributes["src"] == null)
continue;
HtmlAttribute src = img.Attributes["src"];
imgList.Add(src.Value);
if (src.Value.StartsWith("http") ||
src.Value.StartsWith("https") ||
src.Value.StartsWith("www"))
{
images++;
string[] arr = src.Value.Split('/');
imgg = arr[arr.Length - 1];
//imgg = Path.GetFileName(new
Uri(src.Value).LocalPath);
//wc.DownloadFile(src.Value, @"d:\MyImages\" + imgg);
wc.DownloadFile(src.Value, "d:\\MyImages\\" +
Guid.NewGuid() + ".jpg");
}
}
return imgList;
}
catch
{
Logger.Write("There Was Problem Downloading The Image: " +
imgg);
return null;
}
}
}
}
Now im using a breakpoint and step line by line and after doing this line:
HtmlNodeCollection imgs = doc.DocumentNode.SelectNodes("//img[@src]");
The variable imgs is null. Then on the next line that check if its null
its jumping to the end and does nothing.
How can i solve it so it will be able to download the image from
http://members.tripod.com/~VanessaWest/bundybowman2.jpg ?
My program is a webcrawler. Im trying to download images from a website.
In my webcrawler site i did:
try
{
HtmlAgilityPack.HtmlDocument doc =
TimeOut.getHtmlDocumentWebClient(mainUrl, false, "", 0, "", "");
if (doc == null)
{
if (wccfg.downloadcontent == true)
{
retwebcontent.retrieveImages(mainUrl);
}
failed = true;
wccfg.failedUrls++;
failed = false;
}
For example when doc is null the mainUrl contain:
http://members.tripod.com/~VanessaWest/bundybowman2.jpg
Now its jumping to the retrieveImages method in the other class:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using HtmlAgilityPack;
using System.IO;
using System.Text.RegularExpressions;
using System.Xml.Linq;
using System.Net;
using System.Web;
using System.Threading;
using DannyGeneral;
using GatherLinks;
namespace GatherLinks
{
class RetrieveWebContent
{
HtmlAgilityPack.HtmlDocument doc;
string imgg;
int images;
public RetrieveWebContent()
{
images = 0;
}
public List<string> retrieveImages(string address)
{
try
{
doc = new HtmlAgilityPack.HtmlDocument();
System.Net.WebClient wc = new System.Net.WebClient();
List<string> imgList = new List<string>();
doc.Load(wc.OpenRead(address));
HtmlNodeCollection imgs =
doc.DocumentNode.SelectNodes("//img[@src]");
if (imgs == null) return new List<string>();
foreach (HtmlNode img in imgs)
{
if (img.Attributes["src"] == null)
continue;
HtmlAttribute src = img.Attributes["src"];
imgList.Add(src.Value);
if (src.Value.StartsWith("http") ||
src.Value.StartsWith("https") ||
src.Value.StartsWith("www"))
{
images++;
string[] arr = src.Value.Split('/');
imgg = arr[arr.Length - 1];
//imgg = Path.GetFileName(new
Uri(src.Value).LocalPath);
//wc.DownloadFile(src.Value, @"d:\MyImages\" + imgg);
wc.DownloadFile(src.Value, "d:\\MyImages\\" +
Guid.NewGuid() + ".jpg");
}
}
return imgList;
}
catch
{
Logger.Write("There Was Problem Downloading The Image: " +
imgg);
return null;
}
}
}
}
Now im using a breakpoint and step line by line and after doing this line:
HtmlNodeCollection imgs = doc.DocumentNode.SelectNodes("//img[@src]");
The variable imgs is null. Then on the next line that check if its null
its jumping to the end and does nothing.
How can i solve it so it will be able to download the image from
http://members.tripod.com/~VanessaWest/bundybowman2.jpg ?
Tuesday, 27 August 2013
Cookie issue with Java client using HttpURLConnection + Node.js / Express webserver
Cookie issue with Java client using HttpURLConnection + Node.js / Express
webserver
I have a Java client trying to connect to an Express.js webserver serving
content with cookies. The express server works fine on the browser (it
receives session cookies), but not with my Java client. The Java client
shows that the Set-Cookie field on the response header is null.
It's almost certainly a Java problem. I have inspected the network traffic
(using wireshark) and it shows that the Express.js webserver is serving
cookies as expected.
I have the following Java code:
package mine;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.HttpURLConnection;
import java.net.URL;
public class HttpsClient {
public static void main(String[] args) throws Exception {
CookieHandler.setDefault(new CookieManager());
URL obj = new URL("http://localhost:8888");
HttpURLConnection conn = (HttpURLConnection) obj.openConnection();
String headerName=null;
for (int i=1; (headerName = conn.getHeaderFieldKey(i)) != null;
i++) {
System.out.println(headerName + ": " + conn.getHeaderField(i));
}
}
}
The output from the above code:
X-Powered-By: Express
Content-Type: text/html; charset=utf-8
Content-Length: 4535
ETag: "309029400"
Set-Cookie: null
Date: Wed, 28 Aug 2013 04:40:25 GMT
Connection: keep-alive
Below is the express.js / node.js code:
var express = require('express');
var app = express();
var mongoStore = require('connect-mongo')(express);
app.configure(function(){
app.use(express.logger());
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.errorHandler());
app.use(express.session({
store: new mongoStore({
url: 'mongodb://localhost:27017/sessions'
}),
secret: 'asdasdfasdfasdfasdfa',
maxAge : new Date(Date.now() + 24*3600*1000 * 365),
expires : new Date(Date.now() + 24*3600*1000 * 365)
}));
app.use(express.methodOverride());
});
app.get('/', function(req, res) {
res.send('ok', 200);
});
var http = require('http');
http.createServer(app).listen(8888, function(){
console.log('Express server listening on port ' + 8888);
});
Am I missing something here? Does Java have a different way of handling
session cookies?
webserver
I have a Java client trying to connect to an Express.js webserver serving
content with cookies. The express server works fine on the browser (it
receives session cookies), but not with my Java client. The Java client
shows that the Set-Cookie field on the response header is null.
It's almost certainly a Java problem. I have inspected the network traffic
(using wireshark) and it shows that the Express.js webserver is serving
cookies as expected.
I have the following Java code:
package mine;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.HttpURLConnection;
import java.net.URL;
public class HttpsClient {
public static void main(String[] args) throws Exception {
CookieHandler.setDefault(new CookieManager());
URL obj = new URL("http://localhost:8888");
HttpURLConnection conn = (HttpURLConnection) obj.openConnection();
String headerName=null;
for (int i=1; (headerName = conn.getHeaderFieldKey(i)) != null;
i++) {
System.out.println(headerName + ": " + conn.getHeaderField(i));
}
}
}
The output from the above code:
X-Powered-By: Express
Content-Type: text/html; charset=utf-8
Content-Length: 4535
ETag: "309029400"
Set-Cookie: null
Date: Wed, 28 Aug 2013 04:40:25 GMT
Connection: keep-alive
Below is the express.js / node.js code:
var express = require('express');
var app = express();
var mongoStore = require('connect-mongo')(express);
app.configure(function(){
app.use(express.logger());
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.errorHandler());
app.use(express.session({
store: new mongoStore({
url: 'mongodb://localhost:27017/sessions'
}),
secret: 'asdasdfasdfasdfasdfa',
maxAge : new Date(Date.now() + 24*3600*1000 * 365),
expires : new Date(Date.now() + 24*3600*1000 * 365)
}));
app.use(express.methodOverride());
});
app.get('/', function(req, res) {
res.send('ok', 200);
});
var http = require('http');
http.createServer(app).listen(8888, function(){
console.log('Express server listening on port ' + 8888);
});
Am I missing something here? Does Java have a different way of handling
session cookies?
How do I display html encoded values in svg?
How do I display html encoded values in svg?
I am using d3 to generate svg and end up with markup similar to the
following:
<text class="rule" text-anchor="middle">&pound;10K</text>
Compare to similar html that renders as expected.
<div>
£20,160 - £48,069
</div>
Is there a property I need to set on the svg tag to get a similar type of
encoding? I tried adding a meta tag to the page <meta name="content"
content="application/xhtml+xml; charset=utf-8" /> but this did not work.
I am using d3 to generate svg and end up with markup similar to the
following:
<text class="rule" text-anchor="middle">&pound;10K</text>
Compare to similar html that renders as expected.
<div>
£20,160 - £48,069
</div>
Is there a property I need to set on the svg tag to get a similar type of
encoding? I tried adding a meta tag to the page <meta name="content"
content="application/xhtml+xml; charset=utf-8" /> but this did not work.
Referencing Groovy project from another using Eclipse, Maven, maven-eclipse-plugin and build-helper-maven-plugin
Referencing Groovy project from another using Eclipse, Maven,
maven-eclipse-plugin and build-helper-maven-plugin
I have an Eclipse Groovy project, say A, that needs to reference/use the
source code of another Eclipse Groovy project, called GenUtils. In the
Eclipse environment one would select project A and then Properties -->
Projects --> Add and check GenUtils. This produces the following in the
.classpath file of A: ... ...
where "/GenUtils" referenes a project in the workspace. And this works fine.
Now I am trying to do the same with Maven using the maven-eclipse-plugin
to generate the Eclipse project files for A from the maven pom.xml. (Using
mvn eclipse:eclipse)
By researching (I am a Maven newbie) I found that Maven does not support
multiple source locations by default and the recommended solution is the
build-helper-maven-plugin. Using this in my POM: org.codehaus.mojo
build-helper-maven-plugin 1.8 add-source generate-sources add-source
../../GenUtils I can give the relative path of the GenUtils project. This
produces the following in the .classpath file: that is, the project
sources are indeed referenced with an absolute path! Not ideal but would
do for the moment.
The problem is that Eclipse does not accept this and gives the errors: ":
is an invalid character in path 'C:/_SDE/Tools/ArtopBasedTools/GenUtils'."
(Error Log), "Project A us missing required source folder:
'C:/_SDE/Tools/ArtopBasedTools/GenUtils'" (Problems wndow). This is
probably due to the fact that Eclipse expects to reference other workspace
projects not arbitrary directories. It expects in the .classpath file a
path="/GenUtils" entry instead of the full absolute path.
So the question is: Is there a way to specify this in
build-helper-maven-plugin?
More generaly: Is this the correct approach to make accesible a Groovy
Eclipse project from another using Maven? Or is there another recommended
solution?
maven-eclipse-plugin and build-helper-maven-plugin
I have an Eclipse Groovy project, say A, that needs to reference/use the
source code of another Eclipse Groovy project, called GenUtils. In the
Eclipse environment one would select project A and then Properties -->
Projects --> Add and check GenUtils. This produces the following in the
.classpath file of A: ... ...
where "/GenUtils" referenes a project in the workspace. And this works fine.
Now I am trying to do the same with Maven using the maven-eclipse-plugin
to generate the Eclipse project files for A from the maven pom.xml. (Using
mvn eclipse:eclipse)
By researching (I am a Maven newbie) I found that Maven does not support
multiple source locations by default and the recommended solution is the
build-helper-maven-plugin. Using this in my POM: org.codehaus.mojo
build-helper-maven-plugin 1.8 add-source generate-sources add-source
../../GenUtils I can give the relative path of the GenUtils project. This
produces the following in the .classpath file: that is, the project
sources are indeed referenced with an absolute path! Not ideal but would
do for the moment.
The problem is that Eclipse does not accept this and gives the errors: ":
is an invalid character in path 'C:/_SDE/Tools/ArtopBasedTools/GenUtils'."
(Error Log), "Project A us missing required source folder:
'C:/_SDE/Tools/ArtopBasedTools/GenUtils'" (Problems wndow). This is
probably due to the fact that Eclipse expects to reference other workspace
projects not arbitrary directories. It expects in the .classpath file a
path="/GenUtils" entry instead of the full absolute path.
So the question is: Is there a way to specify this in
build-helper-maven-plugin?
More generaly: Is this the correct approach to make accesible a Groovy
Eclipse project from another using Maven? Or is there another recommended
solution?
Float left doesnt work normally
Float left doesnt work normally
I'm trying to make the form responsive. Here is the link to the form page
http://newdev.web-dorado.info/sahakj25/index.php/form Everything works
fine besides the div that contains the two checkboxes. If the div's size
is set to 150px it's not moving down when resizing the page, but if
increase the size to 151px for example it works fine. Can anyone exaplin
what can be the cause of this?
I'm trying to make the form responsive. Here is the link to the form page
http://newdev.web-dorado.info/sahakj25/index.php/form Everything works
fine besides the div that contains the two checkboxes. If the div's size
is set to 150px it's not moving down when resizing the page, but if
increase the size to 151px for example it works fine. Can anyone exaplin
what can be the cause of this?
TCP and UDP transfer explanation
TCP and UDP transfer explanation
Not sure if I chose right StackExchange site, but, anyway, the question:
can TCP packets arrive to receiver by pieces? E.g.: if I send 20 bytes
using TCP protocol, can I be 100% sure that I will receive exactly 20
bytes at once, not 10 bytes then another 10 bytes or so? And the same
question for UDP protocol. I know that UDP is unreliable and packets can
not arrive at all or arrive in different order, but what about 1 packet?
If it arrives, can I be sure that it is a complete packet, not a piece?
Not sure if I chose right StackExchange site, but, anyway, the question:
can TCP packets arrive to receiver by pieces? E.g.: if I send 20 bytes
using TCP protocol, can I be 100% sure that I will receive exactly 20
bytes at once, not 10 bytes then another 10 bytes or so? And the same
question for UDP protocol. I know that UDP is unreliable and packets can
not arrive at all or arrive in different order, but what about 1 packet?
If it arrives, can I be sure that it is a complete packet, not a piece?
Parent of an id using Jquery
Parent of an id using Jquery
<div class="cdlButton" style="width:40px; float: left;"> // want this div
element
<div style="">
<a id="changestatus" class="" onclick="changeWorkflowStatus()"
href="#">
<img id="" width="32px" height="32px" title="disable"
alt="disable" src="images/disable.png">
</a>
</div>
</div>
I want div with help of jquery Right now i am doing this way
$("#changestatus ").parent().parent().addClass('disablecdlButton');
Is there any other way to get top div element
<div class="cdlButton" style="width:40px; float: left;"> // want this div
element
<div style="">
<a id="changestatus" class="" onclick="changeWorkflowStatus()"
href="#">
<img id="" width="32px" height="32px" title="disable"
alt="disable" src="images/disable.png">
</a>
</div>
</div>
I want div with help of jquery Right now i am doing this way
$("#changestatus ").parent().parent().addClass('disablecdlButton');
Is there any other way to get top div element
Monday, 26 August 2013
SQL Server 2008: Snapshot backup
SQL Server 2008: Snapshot backup
Is there a way to convert an unsynchronized snapshot to a writable
database? I'd like to take a production snapshot, copy it to a separate
server, and make it available to developers for testing. However, it would
need to be writable. Any options?
Thanks in advance
Is there a way to convert an unsynchronized snapshot to a writable
database? I'd like to take a production snapshot, copy it to a separate
server, and make it available to developers for testing. However, it would
need to be writable. Any options?
Thanks in advance
Linux Mint 15, Network Manager has been removed, cant connect to the internet
Linux Mint 15, Network Manager has been removed, cant connect to the internet
pAfter installing linux mint, I had strongNetwork Manager/strong. I used
strongwifi/strong, everything was good. But soon, I ned to instal
strongethernet/strong connection. I visited website of my provider and
found how to get internet. It said, that I need strongremove/strong
Network Manager and do everything by my hands in terminal. Then I removed
network manager, and stood without internet connection at all. Ok, they
sais that I need correct strong/etc/network/interfaces/strong. I added
everything like here:/p precodeauto eth0 iface eth0 inet static address
10.2.10.32 netmask 255.255.255.0 gateway 10.2.10.1 dns-nameservers
212.212.45.174 212.212.45.175 /code/pre pthen tried to restart network/p
precodesudo /etc/init.d/networking restart /code/pre pAfter that I got a
great various of unusial thing: my GUI of linux changed great, system
began to work very slow, I couldnt restart my pc. And I turned of pc by
the button. After loading, everything was good, but I don't have internet
at all. How can I install Network-Manager again strongwithout internet
connection/strong? I have stronginstallation cd/strong with linux mint,
can I get network manager from there?/p
pAfter installing linux mint, I had strongNetwork Manager/strong. I used
strongwifi/strong, everything was good. But soon, I ned to instal
strongethernet/strong connection. I visited website of my provider and
found how to get internet. It said, that I need strongremove/strong
Network Manager and do everything by my hands in terminal. Then I removed
network manager, and stood without internet connection at all. Ok, they
sais that I need correct strong/etc/network/interfaces/strong. I added
everything like here:/p precodeauto eth0 iface eth0 inet static address
10.2.10.32 netmask 255.255.255.0 gateway 10.2.10.1 dns-nameservers
212.212.45.174 212.212.45.175 /code/pre pthen tried to restart network/p
precodesudo /etc/init.d/networking restart /code/pre pAfter that I got a
great various of unusial thing: my GUI of linux changed great, system
began to work very slow, I couldnt restart my pc. And I turned of pc by
the button. After loading, everything was good, but I don't have internet
at all. How can I install Network-Manager again strongwithout internet
connection/strong? I have stronginstallation cd/strong with linux mint,
can I get network manager from there?/p
How to decrypt these files (ini, html)?
How to decrypt these files (ini, html)?
Do you have any idea how these files are decrypted? I've tried to open It
with notepad++, but It shows me incomprehensible symbols.
Examaple: file.ini Screenshot: ![ini][1] Download:
href="http://speedy.sh/e3Mca/file.ini">file.ini
Examples: file.css Screenshot: ![css][2] Download: file.css
Example: file.html Screenshot: ![html][3] Download: file.html
[1]: http://i.stack.imgur.com/5uSEl.jpg [2]:
http://i.stack.imgur.com/JPTC9.png [3]: http://i.stack.imgur.com/NM1TN.png
Do you have any idea how these files are decrypted? I've tried to open It
with notepad++, but It shows me incomprehensible symbols.
Examaple: file.ini Screenshot: ![ini][1] Download:
href="http://speedy.sh/e3Mca/file.ini">file.ini
Examples: file.css Screenshot: ![css][2] Download: file.css
Example: file.html Screenshot: ![html][3] Download: file.html
[1]: http://i.stack.imgur.com/5uSEl.jpg [2]:
http://i.stack.imgur.com/JPTC9.png [3]: http://i.stack.imgur.com/NM1TN.png
Connecting to a mysql database from a separate Application
Connecting to a mysql database from a separate Application
First time using OpenShift, and I've read that I am able to connect to a
database on a different application under my account.
I have APPLICATION A that is a Ruby/MySQL project. I have APPLICATION B
that is a PHP project.
I'd like to connect to my APPLICATION A MySQL database from my APPLICATION
B PHP script. When doing an rhc apps command, I can see that my connection
URL reads:
Connection URL: mysql://$OPENSHIFT_MYSQLDB_HOST:$OPENSHIFT_MYSQLDB_PORT
When looking at my environment variables on my APPLICATION A server, I see
they are:
OPENSHIFT_MYSQLDB_PORT=3306
OPENSHIFT_MYSQL_HOST=127.7.171.129
But when I try to connect:
$db = new mysqli('http://127.7.171.129', 'adminuser', 'adminpw',
'productiondb',3306);
And I dump out this:
object(mysqli)#1 (17) {
["affected_rows"]=>
NULL
["client_info"]=>
NULL
["client_version"]=>
int(50169)
["connect_errno"]=>
int(2005)
["connect_error"]=>
string(57) "Unknown MySQL server host 'http://127.7.171.129' (1)"
["errno"]=>
NULL
["error"]=>
NULL
["field_count"]=>
NULL
["host_info"]=>
NULL
["info"]=>
NULL
["insert_id"]=>
NULL
["server_info"]=>
NULL
["server_version"]=>
NULL
["sqlstate"]=>
NULL
["protocol_version"]=>
NULL
["thread_id"]=>
NULL
["warning_count"]=>
NULL
}
First time using OpenShift, and I've read that I am able to connect to a
database on a different application under my account.
I have APPLICATION A that is a Ruby/MySQL project. I have APPLICATION B
that is a PHP project.
I'd like to connect to my APPLICATION A MySQL database from my APPLICATION
B PHP script. When doing an rhc apps command, I can see that my connection
URL reads:
Connection URL: mysql://$OPENSHIFT_MYSQLDB_HOST:$OPENSHIFT_MYSQLDB_PORT
When looking at my environment variables on my APPLICATION A server, I see
they are:
OPENSHIFT_MYSQLDB_PORT=3306
OPENSHIFT_MYSQL_HOST=127.7.171.129
But when I try to connect:
$db = new mysqli('http://127.7.171.129', 'adminuser', 'adminpw',
'productiondb',3306);
And I dump out this:
object(mysqli)#1 (17) {
["affected_rows"]=>
NULL
["client_info"]=>
NULL
["client_version"]=>
int(50169)
["connect_errno"]=>
int(2005)
["connect_error"]=>
string(57) "Unknown MySQL server host 'http://127.7.171.129' (1)"
["errno"]=>
NULL
["error"]=>
NULL
["field_count"]=>
NULL
["host_info"]=>
NULL
["info"]=>
NULL
["insert_id"]=>
NULL
["server_info"]=>
NULL
["server_version"]=>
NULL
["sqlstate"]=>
NULL
["protocol_version"]=>
NULL
["thread_id"]=>
NULL
["warning_count"]=>
NULL
}
R data.table syntax for subsetting and summarising
R data.table syntax for subsetting and summarising
This is probablly quite simple but would like to be able to summarise some
data (mean and median) based upon on random column selection, and for it
to be grouped by a different column.
Please see below:
DT = data.table(x=rep(c("a","b","c"),each=3), y=c(1,3,6), v=1:9)
ww <- sample(c("y","v"),1)
DT[,list(avg=mean(ww),med=median(ww)),by="x"]
x avg med
1: a NA y
2: b NA y
3: c NA y
Warning messages:
1: In `[.data.table`(DT, , list(avg = mean(ww), med = median(ww)), :
argument is not numeric or logical: returning NA
2: In `[.data.table`(DT, , list(avg = mean(ww), med = median(ww)), :
argument is not numeric or logical: returning NA
3: In `[.data.table`(DT, , list(avg = mean(ww), med = median(ww)), :
argument is not numeric or logical: returning NA
If for example ww happened to equal "v" then I would expect the following
output
x avg med
1: a 2 2
2: b 5 5
3: c 8 8
I think it is just syntax that I need to adjust, but am unsure how to
adjust it...Any help would be greatly appreciated...
This is probablly quite simple but would like to be able to summarise some
data (mean and median) based upon on random column selection, and for it
to be grouped by a different column.
Please see below:
DT = data.table(x=rep(c("a","b","c"),each=3), y=c(1,3,6), v=1:9)
ww <- sample(c("y","v"),1)
DT[,list(avg=mean(ww),med=median(ww)),by="x"]
x avg med
1: a NA y
2: b NA y
3: c NA y
Warning messages:
1: In `[.data.table`(DT, , list(avg = mean(ww), med = median(ww)), :
argument is not numeric or logical: returning NA
2: In `[.data.table`(DT, , list(avg = mean(ww), med = median(ww)), :
argument is not numeric or logical: returning NA
3: In `[.data.table`(DT, , list(avg = mean(ww), med = median(ww)), :
argument is not numeric or logical: returning NA
If for example ww happened to equal "v" then I would expect the following
output
x avg med
1: a 2 2
2: b 5 5
3: c 8 8
I think it is just syntax that I need to adjust, but am unsure how to
adjust it...Any help would be greatly appreciated...
AJAX or more specific MooTools Request.JSON error types?
AJAX or more specific MooTools Request.JSON error types?
I'm trying to get myself an overview about all the errors that can occur
on Request.JSON(). I've googled for a while but there seems not to be any
overview about them all. What I've figured out was that the 404 error
occures if no such file is available to request on.
Does anyone have an idea where to find them? I think it has not to be
specific mootools errors, what I'm looking for are the AJAX errors itself.
Kind regards
I'm trying to get myself an overview about all the errors that can occur
on Request.JSON(). I've googled for a while but there seems not to be any
overview about them all. What I've figured out was that the 404 error
occures if no such file is available to request on.
Does anyone have an idea where to find them? I think it has not to be
specific mootools errors, what I'm looking for are the AJAX errors itself.
Kind regards
limit devs on the length of a function
limit devs on the length of a function
We are working in a GIANT project, and as with giant projects some
classes, funcitons, files tend to get, weeelll lets say giant (40k lines
of code in a single file, ifs wich can span over 5k lines of code).
I am looking for a way to annoy the develeopers to the point they split
their "function if fooo" when a file gets to much out of hand.
i need 2 solutions limit the developer so he cant make a function in php
wich is bigger then 2k lines of code. Other one is i need to limit the
lenth of a file to a reasonable size.
We are working with zend and extjs.
We are working in a GIANT project, and as with giant projects some
classes, funcitons, files tend to get, weeelll lets say giant (40k lines
of code in a single file, ifs wich can span over 5k lines of code).
I am looking for a way to annoy the develeopers to the point they split
their "function if fooo" when a file gets to much out of hand.
i need 2 solutions limit the developer so he cant make a function in php
wich is bigger then 2k lines of code. Other one is i need to limit the
lenth of a file to a reasonable size.
We are working with zend and extjs.
Side-effect free version of Underscore.js default function?
Side-effect free version of Underscore.js default function?
To initialize an object using default values I am using Underscore's
default function. According to the documentation, it works like this:
var foo = _.defaults(object, *defaults)
It is described as:
Fill in undefined properties in object with values from the defaults
objects, and return the object. As soon as the property is filled, further
defaults will have no effect.
Although it basically works fine, there is one thing I always stumble
upon: The side effect of manipulating the original object.
If I run
var foo = { bar: 'baz' };
and then say
var bar = _.defaults(foo, { dummy: 23 });
not only, bar has a property called dummy, the original foo object has
been changed as well. My current workaround is:
var bar = _.defaults({}, foo, { dummy: 23 });
Unfortunately, you can easily forget this. I think it's quite a strange
behavior that the defaults function changes an input parameter as well as
returning the result as return value. It should be either or.
How do you deal with that situation? Are there better ways to deal with this?
To initialize an object using default values I am using Underscore's
default function. According to the documentation, it works like this:
var foo = _.defaults(object, *defaults)
It is described as:
Fill in undefined properties in object with values from the defaults
objects, and return the object. As soon as the property is filled, further
defaults will have no effect.
Although it basically works fine, there is one thing I always stumble
upon: The side effect of manipulating the original object.
If I run
var foo = { bar: 'baz' };
and then say
var bar = _.defaults(foo, { dummy: 23 });
not only, bar has a property called dummy, the original foo object has
been changed as well. My current workaround is:
var bar = _.defaults({}, foo, { dummy: 23 });
Unfortunately, you can easily forget this. I think it's quite a strange
behavior that the defaults function changes an input parameter as well as
returning the result as return value. It should be either or.
How do you deal with that situation? Are there better ways to deal with this?
Sunday, 25 August 2013
how to reload page after uploading images
how to reload page after uploading images
I use gem 'jquery-fileupload-rails' and 'carrierwave_backgrounder' gem
with sidekiq. How to add reload the page after download is complete?
fileupload.js
$(function () {
$('#new_photo').fileupload({
acceptFileTypes: '/(\.|\/)(gif|jpe?g|png)$/i',
dataType: 'html',
add: function (e, data) {
data.context =
$('#loading').css({display:"block"}).appendTo('#photos');
data.submit();
},
done: function (e, data) {
data.context.text('Upload finished.');
location.reload();
}
});
});
I use gem 'jquery-fileupload-rails' and 'carrierwave_backgrounder' gem
with sidekiq. How to add reload the page after download is complete?
fileupload.js
$(function () {
$('#new_photo').fileupload({
acceptFileTypes: '/(\.|\/)(gif|jpe?g|png)$/i',
dataType: 'html',
add: function (e, data) {
data.context =
$('#loading').css({display:"block"}).appendTo('#photos');
data.submit();
},
done: function (e, data) {
data.context.text('Upload finished.');
location.reload();
}
});
});
[ Printers ] Open Question : Need Help? Error 1327?? Driver G problem??
[ Printers ] Open Question : Need Help? Error 1327?? Driver G problem??
I recently got a new printer and I was trying to install it and this error
message 1327 invalid driver G popped up. Basically I cant install my
printer because of this issue. I need help on fixing it. Ive tried other
solutions that have failed. PLEASE hELP! p,S i'M AN OLD LADY SO PUT a
SIMPLE FIX. Please and Thank You!!!
I recently got a new printer and I was trying to install it and this error
message 1327 invalid driver G popped up. Basically I cant install my
printer because of this issue. I need help on fixing it. Ive tried other
solutions that have failed. PLEASE hELP! p,S i'M AN OLD LADY SO PUT a
SIMPLE FIX. Please and Thank You!!!
Saturday, 24 August 2013
Optimize PHP Code
Optimize PHP Code
Any suggestions, below is function of toy variant - function
loadProductVarients
At present its displaying :-
a) Toy Variant Name Only, wherein i intend to achieve product name and
variant name. For example if Hotwheels is company, Ferrari is Product and
Zsi is its Variant.
Now below function is displaying only Zsi as variant name, i intend to
achieve Ferrari Zsi as variant name
I think the variable of product needs to be added in $temp1, but despite
using many combinations - i am unable to achieve it.
b) Second is getting PHP Notice: Undefined variable: temp1 & temp2 Notice
in function loadproductvarients
I am on learning PHP - your help and advise will be much appreciated !!
function loadProductVarients($id){
$mainframe =& JFactory::getApplication();
$option = JRequest::getCmd('option');
$database =& JFactory::getDBO();
global $Itemid;
$Vcond="";
$sql = "Select * from #__newcar_variants Where
v_prod_id='".$id."' $Vcond and v_status='1'";
$database->setQuery($sql);
$rows = $database->loadObjectList();
$list="";
if($rows){
foreach($rows as $row){
$temp1.='<li><a
href="index.php?new&id='.$row->v_prod_id.'&vid='.$row->v_id.'">'.$row->v_name.'</a></li>';
$temp2.='<li>Rs. '.$row->v_price.'</li>';
}
$list.='<div
class="sliding-box-middle"><ul>'.$temp1.'</ul></div>';
$list.='<div
class="sliding-box-right"><ul>'.$temp2.'</ul></div>';
}else{
$list.='<p>No Variants.</p>';
}
return $list;
}
Below is function used for loading Product Name - for reference
function loadSubCat($id,$Carmodel){
$mainframe =& JFactory::getApplication();
$option = JRequest::getCmd('option');
$database =& JFactory::getDBO();
global $Itemid;
$cond = '';
if($Carmodel!="") {
$cond = " and prod_id='$Carmodel' ";
}
$sql = "Select * from #__newcar_products Where
prod_cat_id='".$id."' $cond and prod_status='1' and prod_id in
(select v_prod_id from #__newcar_variants) Order By
prod_sorder";
$database->setQuery($sql);
$rows = $database->loadObjectList();
$list="";
if($rows){
$flg=0;
foreach($rows as $row){
$temp='<p>'.$row->prod_name.'
<a href="#"
onclick="ShowHide('.$row->prod_id.');
return false;">Select Variant</a>
<div
id="slidingDiv'.$row->prod_id.'"
class="sliding-box">
'.$this->loadProductVarients($row->prod_id).'
</div>
</p>';
if($flg==0){
$list.=''.$temp.'';
$flg=1;
}else{
$list.=''.$temp.'';
$flg=0;
}
}
}else{
$list.='<p>No Product.</p>';
}
return $list;
}
Any suggestions, below is function of toy variant - function
loadProductVarients
At present its displaying :-
a) Toy Variant Name Only, wherein i intend to achieve product name and
variant name. For example if Hotwheels is company, Ferrari is Product and
Zsi is its Variant.
Now below function is displaying only Zsi as variant name, i intend to
achieve Ferrari Zsi as variant name
I think the variable of product needs to be added in $temp1, but despite
using many combinations - i am unable to achieve it.
b) Second is getting PHP Notice: Undefined variable: temp1 & temp2 Notice
in function loadproductvarients
I am on learning PHP - your help and advise will be much appreciated !!
function loadProductVarients($id){
$mainframe =& JFactory::getApplication();
$option = JRequest::getCmd('option');
$database =& JFactory::getDBO();
global $Itemid;
$Vcond="";
$sql = "Select * from #__newcar_variants Where
v_prod_id='".$id."' $Vcond and v_status='1'";
$database->setQuery($sql);
$rows = $database->loadObjectList();
$list="";
if($rows){
foreach($rows as $row){
$temp1.='<li><a
href="index.php?new&id='.$row->v_prod_id.'&vid='.$row->v_id.'">'.$row->v_name.'</a></li>';
$temp2.='<li>Rs. '.$row->v_price.'</li>';
}
$list.='<div
class="sliding-box-middle"><ul>'.$temp1.'</ul></div>';
$list.='<div
class="sliding-box-right"><ul>'.$temp2.'</ul></div>';
}else{
$list.='<p>No Variants.</p>';
}
return $list;
}
Below is function used for loading Product Name - for reference
function loadSubCat($id,$Carmodel){
$mainframe =& JFactory::getApplication();
$option = JRequest::getCmd('option');
$database =& JFactory::getDBO();
global $Itemid;
$cond = '';
if($Carmodel!="") {
$cond = " and prod_id='$Carmodel' ";
}
$sql = "Select * from #__newcar_products Where
prod_cat_id='".$id."' $cond and prod_status='1' and prod_id in
(select v_prod_id from #__newcar_variants) Order By
prod_sorder";
$database->setQuery($sql);
$rows = $database->loadObjectList();
$list="";
if($rows){
$flg=0;
foreach($rows as $row){
$temp='<p>'.$row->prod_name.'
<a href="#"
onclick="ShowHide('.$row->prod_id.');
return false;">Select Variant</a>
<div
id="slidingDiv'.$row->prod_id.'"
class="sliding-box">
'.$this->loadProductVarients($row->prod_id).'
</div>
</p>';
if($flg==0){
$list.=''.$temp.'';
$flg=1;
}else{
$list.=''.$temp.'';
$flg=0;
}
}
}else{
$list.='<p>No Product.</p>';
}
return $list;
}
EPPlus Read As Collection
EPPlus Read As Collection
Using EPPlus it's easy to generate an Excel file from a generic list,
using the LoadFromCollection method. Now I'm looking to do the opposite.
How can I read an Excel file back into a generic collection, without
looping through each cell value and mapping it myself?
Using EPPlus it's easy to generate an Excel file from a generic list,
using the LoadFromCollection method. Now I'm looking to do the opposite.
How can I read an Excel file back into a generic collection, without
looping through each cell value and mapping it myself?
is there a more elegant regex solution available to matching multiple patterns in a short string
is there a more elegant regex solution available to matching multiple
patterns in a short string
I've been tearing my hair out for the last two hours with this and can't
help feeling there's a simple solution that I'm not seeing. I am trying to
process a string - a house number (as you would find in a street address)
and break it up into four component parts.
The string can have four basic different patterns
A. a numeric value consisting of one or more digits e.g. 5
B. one or more digits followed by a single alphabetic character e.g. 5A
C. two numeric values consisting of one or more digits and joined by a
hyphen e.g. 5-6
D. two alphanumeric values (with each consisting of one or more digits
followed by a single alphabetic character) split by a hyphen e.g. 5A-6B
the string should always start with a numeric character (1-9) but
everything else is optional
I need to end up with four values as follows
startnumber - it would be 5 in the example above
startsuffix - it would be A in the example above
endnumber - it would be 6 in the example above
endsuffix - it would be B in the example above
startnumber and endnumber can be one or more digits. startsuffix and
endsuffix must be a single alphabetic character
I have some basic validation on my form that only allows 0-9, A-Z and the
'-' character to be input
I've been hacking around with lots of if statements, is_numerics, strpos
and so on but can't help feeling there's a more obvious answer there maybe
using a regex but I'm really struggling. Any help would be gratefully
received
patterns in a short string
I've been tearing my hair out for the last two hours with this and can't
help feeling there's a simple solution that I'm not seeing. I am trying to
process a string - a house number (as you would find in a street address)
and break it up into four component parts.
The string can have four basic different patterns
A. a numeric value consisting of one or more digits e.g. 5
B. one or more digits followed by a single alphabetic character e.g. 5A
C. two numeric values consisting of one or more digits and joined by a
hyphen e.g. 5-6
D. two alphanumeric values (with each consisting of one or more digits
followed by a single alphabetic character) split by a hyphen e.g. 5A-6B
the string should always start with a numeric character (1-9) but
everything else is optional
I need to end up with four values as follows
startnumber - it would be 5 in the example above
startsuffix - it would be A in the example above
endnumber - it would be 6 in the example above
endsuffix - it would be B in the example above
startnumber and endnumber can be one or more digits. startsuffix and
endsuffix must be a single alphabetic character
I have some basic validation on my form that only allows 0-9, A-Z and the
'-' character to be input
I've been hacking around with lots of if statements, is_numerics, strpos
and so on but can't help feeling there's a more obvious answer there maybe
using a regex but I'm really struggling. Any help would be gratefully
received
How i can receive response from Paypal without use of IPN Notification URL
How i can receive response from Paypal without use of IPN Notification URL
i have assignment to use paypal for dynamic users only with their email
addresses for paypal accounts. I know the method to send user on paypal
for email address that is provided for paypal, but i don't know how to
keep track if payment has been done or user has closed the page of paypal
without payment ? because on dynamic users i could not use IPN, because
paypal requires its URL. Please help me to solve this issue.
thank you alot.
i have assignment to use paypal for dynamic users only with their email
addresses for paypal accounts. I know the method to send user on paypal
for email address that is provided for paypal, but i don't know how to
keep track if payment has been done or user has closed the page of paypal
without payment ? because on dynamic users i could not use IPN, because
paypal requires its URL. Please help me to solve this issue.
thank you alot.
jquery mobile textarea line breaks dissapears
jquery mobile textarea line breaks dissapears
text in textarea is:
example
line 2 textam
with some code like this I add something to text (or just get current text
and reinsert it to textarea):
var curtxt= $('#editor').text();
$('#editor').text(curtxt);
now text is like:
example line 2 textam
and line breaks removed!
text in textarea is:
example
line 2 textam
with some code like this I add something to text (or just get current text
and reinsert it to textarea):
var curtxt= $('#editor').text();
$('#editor').text(curtxt);
now text is like:
example line 2 textam
and line breaks removed!
Can't remove overlay view
Can't remove overlay view
Trying to implement overlay like fb messenger, truecaller etc.
public class IncomingCall extends BroadcastReceiver
{
private Context pcontext;
private static final String TAG = "CustomBroadcastReceiver";
TelephonyManager telephony;
CustomPhoneStateListener customPhoneListener ;
@Override
public void onReceive(Context context, Intent intent)
{
pcontext = context;
Bundle extras = intent.getExtras();
if (extras != null) {
String state = extras.getString(TelephonyManager.EXTRA_STATE);
Log.w("DEBUG", state);
telephony =
(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
customPhoneListener = new CustomPhoneStateListener();
telephony.listen(customPhoneListener,
PhoneStateListener.LISTEN_CALL_STATE);
Bundle bundle = intent.getExtras();
String phoneNr= bundle.getString("incoming_number");
}
}
public class CustomPhoneStateListener extends PhoneStateListener
{
private static final String TAG = "CustomPhoneStateListener";
Handler handler=new Handler();
@Override
public void onCallStateChanged(int state, String incomingNumber)
{
WindowManager wm = (WindowManager)
pcontext.getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT |
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSPARENT);
params.height = LayoutParams.MATCH_PARENT;
params.width = LayoutParams.MATCH_PARENT;
params.format = PixelFormat.TRANSLUCENT;
params.gravity = Gravity.BOTTOM;
RelativeLayout ly;
final LayoutInflater inflater = (LayoutInflater)
pcontext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
ly = (RelativeLayout) inflater.inflate(R.layout.dialog, null);
switch (state)
{
case TelephonyManager.CALL_STATE_RINGING:
Log.d("Call","RINGING");
wm.addView(ly, params);
break;
case TelephonyManager.CALL_STATE_IDLE:
Log.d("Call","End");
//WindowManager wm = (WindowManager)
pcontext.getSystemService(Context.WINDOW_SERVICE);
if(ly!=null)
{
wm.removeView(ly);
ly = null;
}
break;
default:
break;
}
super.onCallStateChanged(state, incomingNumber);
telephony.listen(customPhoneListener,
PhoneStateListener.LISTEN_NONE);
}
}
}
The addView works fine, Here is the log
"View not attached to window manager"
08-24 20:05:56.404: W/DEBUG(28001): IDLE
08-24 20:05:56.424: D/Call(28001): End
08-24 20:05:56.424: D/AndroidRuntime(28001): Shutting down VM
08-24 20:05:56.424: W/dalvikvm(28001): threadid=1: thread exiting with
uncaught exception (group=0x412982a0)
08-24 20:05:56.444: E/AndroidRuntime(28001): FATAL EXCEPTION: main
08-24 20:05:56.444: E/AndroidRuntime(28001):
java.lang.IllegalArgumentException: View not attached to window manager
08-24 20:05:56.444: E/AndroidRuntime(28001): at
android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:673)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:369)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:160)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
com.androidexample.broadcastreceiver.IncomingCall$CustomPhoneStateListener.onCallStateChanged(IncomingCall.java:105)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
android.telephony.PhoneStateListener$2.handleMessage(PhoneStateListener.java:393)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
android.os.Handler.dispatchMessage(Handler.java:99)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
android.os.Looper.loop(Looper.java:137)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
android.app.ActivityThread.main(ActivityThread.java:4898)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
java.lang.reflect.Method.invokeNative(Native Method)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
java.lang.reflect.Method.invoke(Method.java:511)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
dalvik.system.NativeStart.main(Native Method)
08-24 20:08:22.669: I/Process(28001): Sending signal. PID: 28001 SIG: 9
I had tried creating the layout programmaticaly too.. but no luck
Also can't figure out the id of the generated layout
Trying to implement overlay like fb messenger, truecaller etc.
public class IncomingCall extends BroadcastReceiver
{
private Context pcontext;
private static final String TAG = "CustomBroadcastReceiver";
TelephonyManager telephony;
CustomPhoneStateListener customPhoneListener ;
@Override
public void onReceive(Context context, Intent intent)
{
pcontext = context;
Bundle extras = intent.getExtras();
if (extras != null) {
String state = extras.getString(TelephonyManager.EXTRA_STATE);
Log.w("DEBUG", state);
telephony =
(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
customPhoneListener = new CustomPhoneStateListener();
telephony.listen(customPhoneListener,
PhoneStateListener.LISTEN_CALL_STATE);
Bundle bundle = intent.getExtras();
String phoneNr= bundle.getString("incoming_number");
}
}
public class CustomPhoneStateListener extends PhoneStateListener
{
private static final String TAG = "CustomPhoneStateListener";
Handler handler=new Handler();
@Override
public void onCallStateChanged(int state, String incomingNumber)
{
WindowManager wm = (WindowManager)
pcontext.getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT |
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSPARENT);
params.height = LayoutParams.MATCH_PARENT;
params.width = LayoutParams.MATCH_PARENT;
params.format = PixelFormat.TRANSLUCENT;
params.gravity = Gravity.BOTTOM;
RelativeLayout ly;
final LayoutInflater inflater = (LayoutInflater)
pcontext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
ly = (RelativeLayout) inflater.inflate(R.layout.dialog, null);
switch (state)
{
case TelephonyManager.CALL_STATE_RINGING:
Log.d("Call","RINGING");
wm.addView(ly, params);
break;
case TelephonyManager.CALL_STATE_IDLE:
Log.d("Call","End");
//WindowManager wm = (WindowManager)
pcontext.getSystemService(Context.WINDOW_SERVICE);
if(ly!=null)
{
wm.removeView(ly);
ly = null;
}
break;
default:
break;
}
super.onCallStateChanged(state, incomingNumber);
telephony.listen(customPhoneListener,
PhoneStateListener.LISTEN_NONE);
}
}
}
The addView works fine, Here is the log
"View not attached to window manager"
08-24 20:05:56.404: W/DEBUG(28001): IDLE
08-24 20:05:56.424: D/Call(28001): End
08-24 20:05:56.424: D/AndroidRuntime(28001): Shutting down VM
08-24 20:05:56.424: W/dalvikvm(28001): threadid=1: thread exiting with
uncaught exception (group=0x412982a0)
08-24 20:05:56.444: E/AndroidRuntime(28001): FATAL EXCEPTION: main
08-24 20:05:56.444: E/AndroidRuntime(28001):
java.lang.IllegalArgumentException: View not attached to window manager
08-24 20:05:56.444: E/AndroidRuntime(28001): at
android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:673)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:369)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:160)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
com.androidexample.broadcastreceiver.IncomingCall$CustomPhoneStateListener.onCallStateChanged(IncomingCall.java:105)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
android.telephony.PhoneStateListener$2.handleMessage(PhoneStateListener.java:393)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
android.os.Handler.dispatchMessage(Handler.java:99)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
android.os.Looper.loop(Looper.java:137)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
android.app.ActivityThread.main(ActivityThread.java:4898)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
java.lang.reflect.Method.invokeNative(Native Method)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
java.lang.reflect.Method.invoke(Method.java:511)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
08-24 20:05:56.444: E/AndroidRuntime(28001): at
dalvik.system.NativeStart.main(Native Method)
08-24 20:08:22.669: I/Process(28001): Sending signal. PID: 28001 SIG: 9
I had tried creating the layout programmaticaly too.. but no luck
Also can't figure out the id of the generated layout
My website shows up as a blank page on my desktop
My website shows up as a blank page on my desktop
I have been developing a wordpress theme on my laptop and all is well,
however when I checked it on my desktop today all that loads is a blank
page. I have asked a couple friends to see if it loads for them and they
all say that it does.
I am really not sure how it will not load on this computer, I've cleared
the cache/cookies and reset the ip, still blank. I need to figure out what
is going on quickly before this is supposed to be done.
The website url is http://bbmthemes.com/themes/modular/, the top left logo
should be broken, other than that everything should work.
Can you think of anything that would make one computer not display
anything but a blank page or what I could try to fix this?
Thanks so much
I have been developing a wordpress theme on my laptop and all is well,
however when I checked it on my desktop today all that loads is a blank
page. I have asked a couple friends to see if it loads for them and they
all say that it does.
I am really not sure how it will not load on this computer, I've cleared
the cache/cookies and reset the ip, still blank. I need to figure out what
is going on quickly before this is supposed to be done.
The website url is http://bbmthemes.com/themes/modular/, the top left logo
should be broken, other than that everything should work.
Can you think of anything that would make one computer not display
anything but a blank page or what I could try to fix this?
Thanks so much
Performance testing [on hold]
Performance testing [on hold]
How can I convince my stake holders that the performance of there website
is poor?
I have tried to use Jmeter for testing the performance of the website and
found some good results like the page load time and other stuffs but now I
am finding it difficult to explain it to them.
At the same time is there anything more than this which I can show case to
them and can convince them to improve there website's performance?
How can I convince my stake holders that the performance of there website
is poor?
I have tried to use Jmeter for testing the performance of the website and
found some good results like the page load time and other stuffs but now I
am finding it difficult to explain it to them.
At the same time is there anything more than this which I can show case to
them and can convince them to improve there website's performance?
Get count of ids from a table grouped by a some range of values
Get count of ids from a table grouped by a some range of values
I have a table like this
id | rating
1 | 1.2
2 | 1.3
3 | 2.3
I want a result like
rating row
1 0 2 2 3 1 4 0 5 0
as row with rating less than 1 is 0 row with rating greater than 1 and
less than 2 is 2 row with rating greater than 2 and less than 3 is 1 row
with rating greater than 3 and less than 4 is 0 row with rating greater
than 4 and less than 5 is 0
I am totally blank how to make this query Help me please
I have a table like this
id | rating
1 | 1.2
2 | 1.3
3 | 2.3
I want a result like
rating row
1 0 2 2 3 1 4 0 5 0
as row with rating less than 1 is 0 row with rating greater than 1 and
less than 2 is 2 row with rating greater than 2 and less than 3 is 1 row
with rating greater than 3 and less than 4 is 0 row with rating greater
than 4 and less than 5 is 0
I am totally blank how to make this query Help me please
Friday, 23 August 2013
Find equal columns in different tables in mysql
Find equal columns in different tables in mysql
Is there a way to find automatically the common columns between three
different tables?
Is there a way to find automatically the common columns between three
different tables?
Draw the screen to a window using StretchBlt()
Draw the screen to a window using StretchBlt()
I'm working on a program to capture the screen and then draw it on a window.
This is the drawing thread function:
void DrawFunc(void*hwnd)
{
HDC windowdc=GetDC((HWND)hwnd);
HDC desktopdc=GetDC(GetDesktopWindow());
for(;;)
{
RECT rect;
GetClientRect((HWND)hwnd,&rect);
StretchBlt(windowdc,0,0,rect.right-rect.left,rect.bottom-rect.top,desktopdc,0,0,1920,1080,SRCCOPY);
}
}
The problem is StretchBlt is too slow(about 20 fps) What should I do to
improve the performance? Thanks.
I'm working on a program to capture the screen and then draw it on a window.
This is the drawing thread function:
void DrawFunc(void*hwnd)
{
HDC windowdc=GetDC((HWND)hwnd);
HDC desktopdc=GetDC(GetDesktopWindow());
for(;;)
{
RECT rect;
GetClientRect((HWND)hwnd,&rect);
StretchBlt(windowdc,0,0,rect.right-rect.left,rect.bottom-rect.top,desktopdc,0,0,1920,1080,SRCCOPY);
}
}
The problem is StretchBlt is too slow(about 20 fps) What should I do to
improve the performance? Thanks.
Finding the Norm of an Element
Finding the Norm of an Element
This may sound very trivial, but I do not know what I am missing.
Take $X$ be the space of complex valued continuous functions on $[0,1]$
with the usual sup norm. Take $Y=\{f \in C[0,1]:f(0)=0\}$.
Show that:
$Y$ is closed in $X$
$X/Y$ is isomorphic to the set of complex numbers $\mathbb{C}$.
Consider the quotient space $X/Y$ with the usual quotient norm. Let us
denote the elements of $X/Y$ by $[x]$. Show that $||[f]||=|f(0)|$.
I have done 1 and 2, but unable to do 3.
Thanks for any help.
This may sound very trivial, but I do not know what I am missing.
Take $X$ be the space of complex valued continuous functions on $[0,1]$
with the usual sup norm. Take $Y=\{f \in C[0,1]:f(0)=0\}$.
Show that:
$Y$ is closed in $X$
$X/Y$ is isomorphic to the set of complex numbers $\mathbb{C}$.
Consider the quotient space $X/Y$ with the usual quotient norm. Let us
denote the elements of $X/Y$ by $[x]$. Show that $||[f]||=|f(0)|$.
I have done 1 and 2, but unable to do 3.
Thanks for any help.
Solving equations having a single variable
Solving equations having a single variable
How can I programmatically solve following equations:
1. y=mx+c
2. x^2+z^3=a+b
3. (a+7)^2=3x+4y
4. a+3=1
The values for all the variables will be given by the user except one
unknown which needs to be calculated programmatically. For example for
equation 1 y=3 , m=5 and c=6 then equation becomes:
3=5x+6.
using variations of the same formula like c=y-mx to calculate the value of
c will not work for me as users will also be able to give in their own
formulas for calculation. I tried to push the equation into stack check
for parenthesis and execute the operators but it doesnot work if formulas
are not modified according to the quantity being calculated.
My choice of language is java but any help is much appreciated. Thanks in
advance.
How can I programmatically solve following equations:
1. y=mx+c
2. x^2+z^3=a+b
3. (a+7)^2=3x+4y
4. a+3=1
The values for all the variables will be given by the user except one
unknown which needs to be calculated programmatically. For example for
equation 1 y=3 , m=5 and c=6 then equation becomes:
3=5x+6.
using variations of the same formula like c=y-mx to calculate the value of
c will not work for me as users will also be able to give in their own
formulas for calculation. I tried to push the equation into stack check
for parenthesis and execute the operators but it doesnot work if formulas
are not modified according to the quantity being calculated.
My choice of language is java but any help is much appreciated. Thanks in
advance.
rounded corner submenu and horizontal menue
rounded corner submenu and horizontal menue
I'm creating a joomla template based on protostar and I have these two
problems that I cant solve. 1-I want a simple rectangle sub menue not
rounded one 2.I tried almost everything I knew and fried my brain but it
didn't work.I want a horizontal menue and dont want to use nav-pills class
in joomla because of its rounded shape.
I uploaded image here:
http://imageupload.co.uk/files/2keen8epv3109590uy7i.jpg
thanx!
I'm creating a joomla template based on protostar and I have these two
problems that I cant solve. 1-I want a simple rectangle sub menue not
rounded one 2.I tried almost everything I knew and fried my brain but it
didn't work.I want a horizontal menue and dont want to use nav-pills class
in joomla because of its rounded shape.
I uploaded image here:
http://imageupload.co.uk/files/2keen8epv3109590uy7i.jpg
thanx!
Thursday, 22 August 2013
Check for a java object type from python
Check for a java object type from python
I have 2 java classes Foo and FooBar under some package. Both these
classes implement interface FooIFC. I want to find if the instance of the
interface is of type Foo or FooBar from a python(Jython) script.
I have a static getinstance() in one of the base class(implementors) of IFC
from package import FooIFC
from package import Foo
if FooIFC.getinstance() instanceof Foo:
print "Foo"
else:
print "FooBar"
I also tried isintance(FooIFC.getinstance(), Foo) as well . Which give an
error name not found.
instanceof give expecting colon error .
How do I find the object type from a python script ?
Thanks
I have 2 java classes Foo and FooBar under some package. Both these
classes implement interface FooIFC. I want to find if the instance of the
interface is of type Foo or FooBar from a python(Jython) script.
I have a static getinstance() in one of the base class(implementors) of IFC
from package import FooIFC
from package import Foo
if FooIFC.getinstance() instanceof Foo:
print "Foo"
else:
print "FooBar"
I also tried isintance(FooIFC.getinstance(), Foo) as well . Which give an
error name not found.
instanceof give expecting colon error .
How do I find the object type from a python script ?
Thanks
Prove the Following Property of an Ultrafilter
Prove the Following Property of an Ultrafilter
In her text Introduction to Modern Set Theory , Judith Roitman defined a
filter of a set $X$ as a family $F$ of subsets of $X$ so that:
(a) If $A \in F$ and $X \supseteq B \supseteq A$ then $B \in F$.
(b) If $A_1, ... ,A_n$ are elements of $F$, so is $A1 \cap ... \cap An$.
Then she proceeded to define an ultrafilter as such: "If $F$ is proper
and, for all $A_n \subseteq X$,either $A \in F$ or $X-A \in F$, we say
that $F$ is an ultrafilter."
Now, suppose that $F$ is an ultrafilter on a set $X$. Prove that if $X =
S_1 \cup ... \cup S_n$, then some $S_n \in F$. She wrote, "If not, then,
since no $S_i \in F$, $F$ is proper, and each $X-Si \in F$. So $\cap_{i
\le n}(X-Si) \in F$. But $\cap_{i \le n}(X-Si) = \emptyset \notin F$.
What I did not understand was that if she already defined an ultrafilter
as proper, why did she have to say "since no $S_i \in F$, $F$ is proper
..."? My thinking was that if $X = S_1 \cup ... \cup S_n$ is not an
element of $F$, then by the fact that $F$ is an ultrafilter, $X^c$ =
$\cap_{i \le n}(X-Si) \in F$, but $X^c = \emptyset \notin F$, creating a
contradiction. Did I misunderstand something?
In her text Introduction to Modern Set Theory , Judith Roitman defined a
filter of a set $X$ as a family $F$ of subsets of $X$ so that:
(a) If $A \in F$ and $X \supseteq B \supseteq A$ then $B \in F$.
(b) If $A_1, ... ,A_n$ are elements of $F$, so is $A1 \cap ... \cap An$.
Then she proceeded to define an ultrafilter as such: "If $F$ is proper
and, for all $A_n \subseteq X$,either $A \in F$ or $X-A \in F$, we say
that $F$ is an ultrafilter."
Now, suppose that $F$ is an ultrafilter on a set $X$. Prove that if $X =
S_1 \cup ... \cup S_n$, then some $S_n \in F$. She wrote, "If not, then,
since no $S_i \in F$, $F$ is proper, and each $X-Si \in F$. So $\cap_{i
\le n}(X-Si) \in F$. But $\cap_{i \le n}(X-Si) = \emptyset \notin F$.
What I did not understand was that if she already defined an ultrafilter
as proper, why did she have to say "since no $S_i \in F$, $F$ is proper
..."? My thinking was that if $X = S_1 \cup ... \cup S_n$ is not an
element of $F$, then by the fact that $F$ is an ultrafilter, $X^c$ =
$\cap_{i \le n}(X-Si) \in F$, but $X^c = \emptyset \notin F$, creating a
contradiction. Did I misunderstand something?
Requiring Date and Time
Requiring Date and Time
I need a datetime. I currently have:
Model:
[DisplayFormat(DataFormatString = "{0:f}", ApplyFormatInEditMode = true)]
public DateTime DateFrom { get; set; }
Controller:
assetBookingModel.DateFrom = DateTime.Now.AddDays(1);
View:
@Html.EditorFor(model => model.DateFrom)
This displays a text box with a date and no time. I can add a calendar
extender with a time property without too much problems, but MVC doesn't
seem to have any proper validation for this, or add in the time by
default.
I have searched the web and there isn't too much help to be found.
What is the best way to go about implementing a Date and Time field, that
will not accept only the Date.
I need a datetime. I currently have:
Model:
[DisplayFormat(DataFormatString = "{0:f}", ApplyFormatInEditMode = true)]
public DateTime DateFrom { get; set; }
Controller:
assetBookingModel.DateFrom = DateTime.Now.AddDays(1);
View:
@Html.EditorFor(model => model.DateFrom)
This displays a text box with a date and no time. I can add a calendar
extender with a time property without too much problems, but MVC doesn't
seem to have any proper validation for this, or add in the time by
default.
I have searched the web and there isn't too much help to be found.
What is the best way to go about implementing a Date and Time field, that
will not accept only the Date.
Changes in win32api v2to3? Can import it fine in Python v3 but throws an error in v2
Changes in win32api v2to3? Can import it fine in Python v3 but throws an
error in v2
I have been working with Python over the last few months, writing a few
apps in version 3.3 I now need to write an app that references modules
only in v2, so I'm starting to work with Python 2.7.5 I wrote a similar
app in v3, so I thought I'd start there by modifying some of the code I
uses in 3.3 to 2.7.5
However, I am at the VERY beginning and am already stumped. I downloaded
python 2.7 as well as pywin32 for 2.7. However, I am getting an import
error involving the win32api module, which is needed for win32com.client.
Here's the code I used in 3.3, which works
from win32com.client import Dispatch
from adodbapi import *
from time import sleep
import os
import xml.etree.ElementTree as ET
import urllib
import string
import csv
from urllib.request import urlopen
from xml.sax.saxutils import escape
from urllib.parse import urlencode
from urllib.parse import quote
Here's the code from 2.7, which does not work (I've commented out the
specific urllib requests because I know those changed from 2to3 and
haven't gotten to them yet)
from win32com.client import Dispatch
import adodbapi
from time import sleep
import os
import xml.etree.ElementTree as ET
import urllib, urllib2
import string
import csv
#from urllib.request import urlopen
#from xml.sax.saxutils import escape
#from urllib.parse import urlencode
#from urllib.parse import quote
The specific error I get is
Traceback (most recent call last):
File "C:\Users\...", line 1, in <module>
from win32com.client import Dispatch
File "C:\Python27\lib\site-packages\win32com\__init__.py", line 5, in
<module>
import win32api, sys, os
ImportError: DLL load failed: The specified module could not be found.
when I run
help ('modules')
in 2.7.5, I see that win32api does exist and is found by PYTHONPATH. I can
import sys & os without issue. The issue definitely lies with win32api.
This seems so basic. What am I missing??
error in v2
I have been working with Python over the last few months, writing a few
apps in version 3.3 I now need to write an app that references modules
only in v2, so I'm starting to work with Python 2.7.5 I wrote a similar
app in v3, so I thought I'd start there by modifying some of the code I
uses in 3.3 to 2.7.5
However, I am at the VERY beginning and am already stumped. I downloaded
python 2.7 as well as pywin32 for 2.7. However, I am getting an import
error involving the win32api module, which is needed for win32com.client.
Here's the code I used in 3.3, which works
from win32com.client import Dispatch
from adodbapi import *
from time import sleep
import os
import xml.etree.ElementTree as ET
import urllib
import string
import csv
from urllib.request import urlopen
from xml.sax.saxutils import escape
from urllib.parse import urlencode
from urllib.parse import quote
Here's the code from 2.7, which does not work (I've commented out the
specific urllib requests because I know those changed from 2to3 and
haven't gotten to them yet)
from win32com.client import Dispatch
import adodbapi
from time import sleep
import os
import xml.etree.ElementTree as ET
import urllib, urllib2
import string
import csv
#from urllib.request import urlopen
#from xml.sax.saxutils import escape
#from urllib.parse import urlencode
#from urllib.parse import quote
The specific error I get is
Traceback (most recent call last):
File "C:\Users\...", line 1, in <module>
from win32com.client import Dispatch
File "C:\Python27\lib\site-packages\win32com\__init__.py", line 5, in
<module>
import win32api, sys, os
ImportError: DLL load failed: The specified module could not be found.
when I run
help ('modules')
in 2.7.5, I see that win32api does exist and is found by PYTHONPATH. I can
import sys & os without issue. The issue definitely lies with win32api.
This seems so basic. What am I missing??
Usage of ETS R codes through RExcel macros in VBA
Usage of ETS R codes through RExcel macros in VBA
Issue: Usage of ETS R codes through RExcel macros in VBA
Given below is my command code:
Rinterface.runrcodefromrange Range("Sheet1!B2:D8")
Following are the codes written in the given cell reference:
#!rput zz 'Sheet1'!$B$2:$B$22
library(forecast)
zz <- ts(zz,freq=365,start=c(2009,1))
etsz <- ets(zz,model='AAN')
etszP <- forecast(etsz,h=34)
write.table(etszP)
How can I import the output table at the end of the code from RExcel to
Excel using Rexcel Macros?
Other option I have tried is:
Rinterface.getarray "etszP", Range("Sheet1!Z1") The output in this case is
not in the desired format.
Issue: Usage of ETS R codes through RExcel macros in VBA
Given below is my command code:
Rinterface.runrcodefromrange Range("Sheet1!B2:D8")
Following are the codes written in the given cell reference:
#!rput zz 'Sheet1'!$B$2:$B$22
library(forecast)
zz <- ts(zz,freq=365,start=c(2009,1))
etsz <- ets(zz,model='AAN')
etszP <- forecast(etsz,h=34)
write.table(etszP)
How can I import the output table at the end of the code from RExcel to
Excel using Rexcel Macros?
Other option I have tried is:
Rinterface.getarray "etszP", Range("Sheet1!Z1") The output in this case is
not in the desired format.
Angular expression that updates model on click
Angular expression that updates model on click
I have a coulple of hidden DOM-elements:
<label ng-show="input">Namn</label>
I would like them to be updated using the ng-click-attribute. What
expression should I use?
I have a coulple of hidden DOM-elements:
<label ng-show="input">Namn</label>
I would like them to be updated using the ng-click-attribute. What
expression should I use?
Does/Will Rust support functional programming idioms?
Does/Will Rust support functional programming idioms?
As Rust gets fleshed more and more, my interest in it begins to peek. I
love the fact that it supports algebraic data types and in particular
matching of those, but are there any thoughts made on other functional
idioms?
E.g. is there a collection of the standard filter/map/reduce functions in
the standard library, and more important, can you chain/compose them in a
syntactical pleasing manner [1]?
Since there are already elegant means for ADTs to be used, how about
monads, in particular some syntactic sugar for them?
[1] Haskell got (.) and (>>>), C# extension methods and optionally LINQ, D
has unified function call syntax.
As Rust gets fleshed more and more, my interest in it begins to peek. I
love the fact that it supports algebraic data types and in particular
matching of those, but are there any thoughts made on other functional
idioms?
E.g. is there a collection of the standard filter/map/reduce functions in
the standard library, and more important, can you chain/compose them in a
syntactical pleasing manner [1]?
Since there are already elegant means for ADTs to be used, how about
monads, in particular some syntactic sugar for them?
[1] Haskell got (.) and (>>>), C# extension methods and optionally LINQ, D
has unified function call syntax.
Wednesday, 21 August 2013
Load from Json with dynamic patterns
Load from Json with dynamic patterns
I am trying to save fabric canvas and reload it using loadFromJson. But
iam getting error patternSourceCanvas is not defined. I thought i should
make it global so i removed var. But when i fill the some other new shape
with new pattern ,this new pattern is applied to all the previously drawn
shapes which have old patterns on the canvas. Kindly help me with dynamic
patterns . here is my code.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Dynamic patterns | Fabric.js Demos</title>
<!--[if lt IE 9]>
<script src="../lib/excanvas.js"></script>
<![endif]-->
<!-- <script src="base/prism.js"></script> -->
<script src="http://fabricjs.com/lib/fabric.js"></script>
</head>
<body>
<div id="bd-wrapper">
<h2><span>Fabric.js demos</span>Dynamic patterns</h2>
<div>
<p>
<label>Repeat pattern?</label>
<input type="checkbox" id="img-repeat" checked>
</p>
<p>
<label>Pattern image width</label>
<input type="range" min="50" max="1000" value="100" id="img-width">
</p>
<p>
<label>Pattern left offset</label>
<input type="range" min="0" max="500" value="0" id="img-offset-x">
</p>
<p>
<label>Pattern top offset</label>
<input type="range" min="0" max="500" value="0" id="img-offset-y">
</p>
<br>
<p>
<label>Pattern image angle</label>
<input type="range" min="-90" max="90" value="0" id="img-angle">
</p>
<p>
<label>Pattern image padding</label>
<input type="range" min="-50" max="50" value="0" id="img-padding">
</p>
</div>
<div><button id="toJson">TOJSON</button></div>
<div><button id="fromJson">LoadFromJSON</button></div>
<canvas id="c" width="500" height="500" style="border:1px solid
#ccc"></canvas>
<script>
var canvas = new fabric.Canvas('c');
var padding = 0;
fabric.Image.fromURL('http://fabricjs.com/assets/pug.jpg', function(img) {
img.scaleToWidth(100).set({
originX: 'left',
originY: 'top'
});
var patternSourceCanvas = new fabric.StaticCanvas();
patternSourceCanvas.add(img);
var pattern = new fabric.Pattern({
source: function() {
patternSourceCanvas.setDimensions({
width: img.getWidth() + padding,
height: img.getHeight() + padding
});
return patternSourceCanvas.getElement();
},
repeat: 'repeat'
});
canvas.add(new fabric.Polygon([
{x: 185, y: 0},
{x: 250, y: 100},
{x: 385, y: 170},
{x: 0, y: 245} ], {
left: 220,
top: 200,
angle: -30,
fill: pattern
}));
document.getElementById('img-width').onchange = function() {
img.scaleToWidth(parseInt(this.value, 10));
canvas.renderAll();
};
document.getElementById('img-angle').onchange = function() {
img.setAngle(this.value);
canvas.renderAll();
};
document.getElementById('img-padding').onchange = function() {
padding = parseInt(this.value, 10);
canvas.renderAll();
};
document.getElementById('img-offset-x').onchange = function() {
pattern.offsetX = parseInt(this.value, 10);
canvas.renderAll();
};
document.getElementById('img-offset-y').onchange = function() {
pattern.offsetY = parseInt(this.value, 10);
canvas.renderAll();
};
document.getElementById('img-repeat').onclick = function() {
pattern.repeat = this.checked ? 'repeat' : 'no-repeat';
canvas.renderAll();
};
});
document.getElementById('toJson').onclick = function () {
jsonData = JSON.stringify(canvas);
}
document.getElementById('fromJson').onclick = function () {
canvas.clear();
canvas.loadFromJSON(jsonData);
canvas.renderAll();
}
</script>
</body>
</html>
I am trying to save fabric canvas and reload it using loadFromJson. But
iam getting error patternSourceCanvas is not defined. I thought i should
make it global so i removed var. But when i fill the some other new shape
with new pattern ,this new pattern is applied to all the previously drawn
shapes which have old patterns on the canvas. Kindly help me with dynamic
patterns . here is my code.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Dynamic patterns | Fabric.js Demos</title>
<!--[if lt IE 9]>
<script src="../lib/excanvas.js"></script>
<![endif]-->
<!-- <script src="base/prism.js"></script> -->
<script src="http://fabricjs.com/lib/fabric.js"></script>
</head>
<body>
<div id="bd-wrapper">
<h2><span>Fabric.js demos</span>Dynamic patterns</h2>
<div>
<p>
<label>Repeat pattern?</label>
<input type="checkbox" id="img-repeat" checked>
</p>
<p>
<label>Pattern image width</label>
<input type="range" min="50" max="1000" value="100" id="img-width">
</p>
<p>
<label>Pattern left offset</label>
<input type="range" min="0" max="500" value="0" id="img-offset-x">
</p>
<p>
<label>Pattern top offset</label>
<input type="range" min="0" max="500" value="0" id="img-offset-y">
</p>
<br>
<p>
<label>Pattern image angle</label>
<input type="range" min="-90" max="90" value="0" id="img-angle">
</p>
<p>
<label>Pattern image padding</label>
<input type="range" min="-50" max="50" value="0" id="img-padding">
</p>
</div>
<div><button id="toJson">TOJSON</button></div>
<div><button id="fromJson">LoadFromJSON</button></div>
<canvas id="c" width="500" height="500" style="border:1px solid
#ccc"></canvas>
<script>
var canvas = new fabric.Canvas('c');
var padding = 0;
fabric.Image.fromURL('http://fabricjs.com/assets/pug.jpg', function(img) {
img.scaleToWidth(100).set({
originX: 'left',
originY: 'top'
});
var patternSourceCanvas = new fabric.StaticCanvas();
patternSourceCanvas.add(img);
var pattern = new fabric.Pattern({
source: function() {
patternSourceCanvas.setDimensions({
width: img.getWidth() + padding,
height: img.getHeight() + padding
});
return patternSourceCanvas.getElement();
},
repeat: 'repeat'
});
canvas.add(new fabric.Polygon([
{x: 185, y: 0},
{x: 250, y: 100},
{x: 385, y: 170},
{x: 0, y: 245} ], {
left: 220,
top: 200,
angle: -30,
fill: pattern
}));
document.getElementById('img-width').onchange = function() {
img.scaleToWidth(parseInt(this.value, 10));
canvas.renderAll();
};
document.getElementById('img-angle').onchange = function() {
img.setAngle(this.value);
canvas.renderAll();
};
document.getElementById('img-padding').onchange = function() {
padding = parseInt(this.value, 10);
canvas.renderAll();
};
document.getElementById('img-offset-x').onchange = function() {
pattern.offsetX = parseInt(this.value, 10);
canvas.renderAll();
};
document.getElementById('img-offset-y').onchange = function() {
pattern.offsetY = parseInt(this.value, 10);
canvas.renderAll();
};
document.getElementById('img-repeat').onclick = function() {
pattern.repeat = this.checked ? 'repeat' : 'no-repeat';
canvas.renderAll();
};
});
document.getElementById('toJson').onclick = function () {
jsonData = JSON.stringify(canvas);
}
document.getElementById('fromJson').onclick = function () {
canvas.clear();
canvas.loadFromJSON(jsonData);
canvas.renderAll();
}
</script>
</body>
</html>
bash script 2000 cURL request
bash script 2000 cURL request
i'm new with bash script so please keep calm with me ^^
I want to write bash script that request 2000 cURL request
is it fast & possible ?
or what should I do for this situation ?
Thanks
i'm new with bash script so please keep calm with me ^^
I want to write bash script that request 2000 cURL request
is it fast & possible ?
or what should I do for this situation ?
Thanks
problem with dependencies while installing ubuntu-sdk
problem with dependencies while installing ubuntu-sdk
I get this error while installing ubuntu-sdk on clean install of Ubuntu
13.04 64bit:
szymon@szymon-PC:~$ sudo apt-get install ubuntu-sdk
[sudo] password for szymon:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies.
ubuntu-sdk : Depends: qtcreator-plugin-ubuntu but it is not going to be
installed
Depends: qtcreator-plugin-ubuntu-cordova but it is not going
to be installed
E: Unable to correct problems, you have held broken packages.
Any ideas ?
I get this error while installing ubuntu-sdk on clean install of Ubuntu
13.04 64bit:
szymon@szymon-PC:~$ sudo apt-get install ubuntu-sdk
[sudo] password for szymon:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies.
ubuntu-sdk : Depends: qtcreator-plugin-ubuntu but it is not going to be
installed
Depends: qtcreator-plugin-ubuntu-cordova but it is not going
to be installed
E: Unable to correct problems, you have held broken packages.
Any ideas ?
Coldfusion Spreadsheet cell formatting
Coldfusion Spreadsheet cell formatting
I need to generate excel spreadsheet with coldfusion 10 from a query. So
far its working fine except the headers of the table. They are dynamically
generated [month Year] December 2012. When I add a header column I get it
in the date format like '01/12/2013'. There are other types of date
formatting and other types of cell formatting. How do I force a cell to
format as a string. Kind of when you add single quotation.
This is my code:
<cfset VARIABLES.vcFilename = "billtotals_" & DateFormat(Now(),
"yyyymmdd") & "-" & TimeFormat(Now(), "HHmmss") & ".xls">
<cfset VARIABLES.sheet = SpreadSheetNew( "Summary" )>
<cfset VARIABLES.columns =
arrayToList(GetBillPremTotals.getMeta().getColumnLabels())>
<cfset SpreadSheetAddRow( VARIABLES.sheet,VARIABLES.columns)>
<cfset format1 = StructNew()>
<cfset format1.bold = "true">
// tried this just for kicks doesn't work <cfset format1.dataformat = "'">
<cfset SpreadsheetFormatRow(VARIABLES.sheet, format1, 1)>
<cfset SpreadSheetAddRows(VARIABLES.sheet,GetBillPremTotals)>
<cfset SpreadSheetAddRows(VARIABLES.sheet,GetBillPremGrandTotals)>
<cfset VARIABLES.sheetAsBinary = SpreadSheetReadBinary(VARIABLES.sheet)>
<cfheader name="Content-Disposition" value="attachment;
filename=#Chr(34)##VARIABLES.vcFilename##Chr(34)#">
<cfcontent type="application/msexcel" variable="#VARIABLES.sheetAsBinary#"
reset="true">
Thank you in advance, Gena
I need to generate excel spreadsheet with coldfusion 10 from a query. So
far its working fine except the headers of the table. They are dynamically
generated [month Year] December 2012. When I add a header column I get it
in the date format like '01/12/2013'. There are other types of date
formatting and other types of cell formatting. How do I force a cell to
format as a string. Kind of when you add single quotation.
This is my code:
<cfset VARIABLES.vcFilename = "billtotals_" & DateFormat(Now(),
"yyyymmdd") & "-" & TimeFormat(Now(), "HHmmss") & ".xls">
<cfset VARIABLES.sheet = SpreadSheetNew( "Summary" )>
<cfset VARIABLES.columns =
arrayToList(GetBillPremTotals.getMeta().getColumnLabels())>
<cfset SpreadSheetAddRow( VARIABLES.sheet,VARIABLES.columns)>
<cfset format1 = StructNew()>
<cfset format1.bold = "true">
// tried this just for kicks doesn't work <cfset format1.dataformat = "'">
<cfset SpreadsheetFormatRow(VARIABLES.sheet, format1, 1)>
<cfset SpreadSheetAddRows(VARIABLES.sheet,GetBillPremTotals)>
<cfset SpreadSheetAddRows(VARIABLES.sheet,GetBillPremGrandTotals)>
<cfset VARIABLES.sheetAsBinary = SpreadSheetReadBinary(VARIABLES.sheet)>
<cfheader name="Content-Disposition" value="attachment;
filename=#Chr(34)##VARIABLES.vcFilename##Chr(34)#">
<cfcontent type="application/msexcel" variable="#VARIABLES.sheetAsBinary#"
reset="true">
Thank you in advance, Gena
How to check if address is contained in a continent or close to another address in android google maps api v2?
How to check if address is contained in a continent or close to another
address in android google maps api v2?
In my app, I have a list of locations, and I want to create filter
settings. I am looking for a way so that a user can pick maybe a continent
or country or address and then filter out the locations from the list if
the location is within the continent or country or close to the address.
Is there a google maps v2 api for android that can do something like:
public Boolean AddressIsContained(String address, String place);
which returns true if address is within place (place could be like a
country or continent). And also like
public Boolean AddressCloseTo(String address1, String address2, int
distance);
which returns true if address1is within distance amount of kilometers to
address2. And this would just be a straight line between the addresses,
nothing like a bike, walk, car or plane route.
Also for the list of locations, I am also able to access its lat/long if
that makes it easier.
Thanks
address in android google maps api v2?
In my app, I have a list of locations, and I want to create filter
settings. I am looking for a way so that a user can pick maybe a continent
or country or address and then filter out the locations from the list if
the location is within the continent or country or close to the address.
Is there a google maps v2 api for android that can do something like:
public Boolean AddressIsContained(String address, String place);
which returns true if address is within place (place could be like a
country or continent). And also like
public Boolean AddressCloseTo(String address1, String address2, int
distance);
which returns true if address1is within distance amount of kilometers to
address2. And this would just be a straight line between the addresses,
nothing like a bike, walk, car or plane route.
Also for the list of locations, I am also able to access its lat/long if
that makes it easier.
Thanks
Tomcat not able to access outside the server
Tomcat not able to access outside the server
I have installed Tomcat 7 in windows 2008 server R2. I am able to Tomcat
home page by the url http://localhost:8080/ But not able to access outside
the server using IP Address.
The same setup i done in the test server where everything works fine. This
one production server and Cisco router is connected. I tried by disabling
the windows firewall also. But no luck.
When type the url ipaddress:8080, cisco router configuration page opens.
Do you need to do anything in the cisco router to access the tomcat ?
I have installed Tomcat 7 in windows 2008 server R2. I am able to Tomcat
home page by the url http://localhost:8080/ But not able to access outside
the server using IP Address.
The same setup i done in the test server where everything works fine. This
one production server and Cisco router is connected. I tried by disabling
the windows firewall also. But no luck.
When type the url ipaddress:8080, cisco router configuration page opens.
Do you need to do anything in the cisco router to access the tomcat ?
Visual Studio 2012 Can't load projects after installing Update 3
Visual Studio 2012 Can't load projects after installing Update 3
I am on Windows 8, updated my Visual Studio 2012 Ultimate to Update 3
recently. Immediately after successful update, I tried loading the project
i was working on (I so wish I had not updated in between the on going
project) now it gives me the error which says load faied in front of all
projects in the solution.
I tried to resolve error by right clicking on solution, but it gives me
error All property accessors must be methods. in an error dialog box. Same
error comes when i try to make new project as well.
Any one know any work around?
I am on Windows 8, updated my Visual Studio 2012 Ultimate to Update 3
recently. Immediately after successful update, I tried loading the project
i was working on (I so wish I had not updated in between the on going
project) now it gives me the error which says load faied in front of all
projects in the solution.
I tried to resolve error by right clicking on solution, but it gives me
error All property accessors must be methods. in an error dialog box. Same
error comes when i try to make new project as well.
Any one know any work around?
Tuesday, 20 August 2013
How to group records based on dates in java?
How to group records based on dates in java?
I have a data-set which has 10K rows and each row is appended at the end
with a random date between, say 06-01-2010 through 06-10-2010. I need to
group the rows based on those 10 different dates and put all the rows with
the same date in a folder which has the date as its name.
I am not very much into Java and so any help would highly be appreciated.
Thanks a lot in advance,
I have a data-set which has 10K rows and each row is appended at the end
with a random date between, say 06-01-2010 through 06-10-2010. I need to
group the rows based on those 10 different dates and put all the rows with
the same date in a folder which has the date as its name.
I am not very much into Java and so any help would highly be appreciated.
Thanks a lot in advance,
What does less than 0. (0 dot) mean?
What does less than 0. (0 dot) mean?
I just saw this for the first time. The source code I'm looking at is in C
if( rate < 0.){
}
else{
}
What happens if rate = 0?
I just saw this for the first time. The source code I'm looking at is in C
if( rate < 0.){
}
else{
}
What happens if rate = 0?
What does setting a time zone on Google Calendar actually achieve?
What does setting a time zone on Google Calendar actually achieve?
I'm currently in GMT+1, and have just created a calendar with a GMT-5 time
zone. If I add a new event to this calendar, it is created with my current
GMT+1 time zone. To create an event at GMT-5, I have to specifically set
the new event time zone to GMT-5 when I create it. It will then be shown
adjusted to GMT+1.
But if I have to specifically set the time zone of every event I create in
this new calendar, then what's the point of setting the calendar time zone
to GMT-5 in the first place?
I'm currently in GMT+1, and have just created a calendar with a GMT-5 time
zone. If I add a new event to this calendar, it is created with my current
GMT+1 time zone. To create an event at GMT-5, I have to specifically set
the new event time zone to GMT-5 when I create it. It will then be shown
adjusted to GMT+1.
But if I have to specifically set the time zone of every event I create in
this new calendar, then what's the point of setting the calendar time zone
to GMT-5 in the first place?
DataGridView e.columnindex not working
DataGridView e.columnindex not working
private void moviesGridView_CellContentClick(object sender,
DataGridViewCellEventArgs e)
{
MovieDetailsForm form = new
MovieDetailsForm(MovieDetailsForm.MovieViewMode.Read);
if (e.ColumnIndex==5)
{
form.ShowDialog();
}
}
I am trying to view the details of a movie when i press the view details
button in the datagridview but for some reason i cant get it to work. the
place of the buttons in the datagridview is 5.
i'd show a ss but unfortunately i cant, yet.
private void moviesGridView_CellContentClick(object sender,
DataGridViewCellEventArgs e)
{
MovieDetailsForm form = new
MovieDetailsForm(MovieDetailsForm.MovieViewMode.Read);
if (e.ColumnIndex==5)
{
form.ShowDialog();
}
}
I am trying to view the details of a movie when i press the view details
button in the datagridview but for some reason i cant get it to work. the
place of the buttons in the datagridview is 5.
i'd show a ss but unfortunately i cant, yet.
strange behavior after updates
strange behavior after updates
i have a centos 6.4 with plesk installed. same days ago i have updated
plesk to 11.5.30 and the os with yum update. After these actions my server
have been strange behavior
in log access i noticed that there are, every 5 minutes, an access to my
server from my server, like this: IP_my_server - - [18/Aug/2013:04:16:48
+0200] "GET / HTTP/1.1" 200 915 "-" "-" ....
what's the meaning?
i have a centos 6.4 with plesk installed. same days ago i have updated
plesk to 11.5.30 and the os with yum update. After these actions my server
have been strange behavior
in log access i noticed that there are, every 5 minutes, an access to my
server from my server, like this: IP_my_server - - [18/Aug/2013:04:16:48
+0200] "GET / HTTP/1.1" 200 915 "-" "-" ....
what's the meaning?
Monday, 19 August 2013
Controller for selecting enum values
Controller for selecting enum values
I need to select Coolants with Grape and Mango Only to be listed in a View
namespace Coolant.Models.Fruits {
public enum Category {
Apple = 0,
Mango = 1,
Pineapple = 2,
Grape = 3
}
}
This is the controller that I used to list only grapes . How should I
reformat inorder to list all the Grape and Mango coolants
# region Available
[HttpGet]
public ViewResult Availability(string cg) {
return View(new Coolant().List(Category.Grape));
}
# endregion
I need to select Coolants with Grape and Mango Only to be listed in a View
namespace Coolant.Models.Fruits {
public enum Category {
Apple = 0,
Mango = 1,
Pineapple = 2,
Grape = 3
}
}
This is the controller that I used to list only grapes . How should I
reformat inorder to list all the Grape and Mango coolants
# region Available
[HttpGet]
public ViewResult Availability(string cg) {
return View(new Coolant().List(Category.Grape));
}
# endregion
compare local maven repository to remote
compare local maven repository to remote
I want to know if there is a maven repository management tool that will
compare my local repository artifacts with a remote repository and produce
a report showing what are the differences. Better yet, a tool that will
allow me to choose what artifacts to upload from the local top the remote.
Thanks
I want to know if there is a maven repository management tool that will
compare my local repository artifacts with a remote repository and produce
a report showing what are the differences. Better yet, a tool that will
allow me to choose what artifacts to upload from the local top the remote.
Thanks
@>Watch Pittsburgh Steelers vs Washington Redskins Live Streaming NFL online HD Tv on your Pc 2013
@>Watch Pittsburgh Steelers vs Washington Redskins Live Streaming NFL
online HD Tv on your Pc 2013
You can simply lookout NFL Match Between Pittsburgh Steelers vs Washington
Redskins Free live streaming available on pc, fair follow our streaming
link. Enjoy Pittsburgh Steelers vs Washington Redskins live streaming NFL
Game Online HD on your Pc. Our software likewise allows you to watch
Pittsburgh Steelers vs Washington Redskins Free live Streaming Online. You
can watch this match up from home through your family if you don't have
sufficient time to visit the stadium, Just opportunity on your PC, Laptop,
PC Mac and IPhone ipad then watch the game from your PC or laptop or PC
Mac and iPhone Ipad. Don't worry, it is too easy to watch.
http://satellite-nfltv.blogspot.com/2013/08/nflwatch-washington-vs-pittsburgh-live.html
Click Here Watch Only $4 Live Guarantee that you must be 100% satisfied in
out service so don't be hesitated just click the link bellow and start
watching and enjoy more. Best of luck both team are ready to face each
other. So this match will be very Pleasant Watch Live Sky Sporting, Bet
Air Tv, CBS, HD4, FOX, NBC, ESPN TV and 3500+ HD Stations Get the best
online sports coverage on the net directly on your PC, MAC or LAPTOP Click
Here Watch HD Live
Click Here Watch HQ Live Fixture Details Match : Pittsburgh Steelers vs
Washington Redskins live NFL: Preseason Week 2, 2013 DATE: Monday August
19, 2013 TIME: 8:00 PM( ET) Live / Repeat:Live Don't worry,it is too easy
to watch.just try it.
Over 3500 Live Streaming HD Channels Stream Nonstop to your PC or Laptop
No hardware purchases required ever No Monthly charges / No Bandwidth
limits unrestricted worldwide TV Channel coverage No TV restrictions / No
Streaming restrictions Full HD widescreen Playback Support. You all about
US,UK,CAN, AUS, NEZ, Game entertainment like NFL, NCAAF, NFL, MLB, RUGBY,
NASCAR, SOCCER, BOXING, FORMULA ONE, ect by which All of you can watch
each and every games live streaming online. From any location! Get instant
access and most exciting sports coverage stream software online directly
on your PC. Download and install our software and like all the pleasures
of the sporting world comfortably like you are at the stadium watching the
Our software also allows you to watch Pittsburgh Steelers vs Washington
Redskins free Live Game online in perfect HD quality,
online HD Tv on your Pc 2013
You can simply lookout NFL Match Between Pittsburgh Steelers vs Washington
Redskins Free live streaming available on pc, fair follow our streaming
link. Enjoy Pittsburgh Steelers vs Washington Redskins live streaming NFL
Game Online HD on your Pc. Our software likewise allows you to watch
Pittsburgh Steelers vs Washington Redskins Free live Streaming Online. You
can watch this match up from home through your family if you don't have
sufficient time to visit the stadium, Just opportunity on your PC, Laptop,
PC Mac and IPhone ipad then watch the game from your PC or laptop or PC
Mac and iPhone Ipad. Don't worry, it is too easy to watch.
http://satellite-nfltv.blogspot.com/2013/08/nflwatch-washington-vs-pittsburgh-live.html
Click Here Watch Only $4 Live Guarantee that you must be 100% satisfied in
out service so don't be hesitated just click the link bellow and start
watching and enjoy more. Best of luck both team are ready to face each
other. So this match will be very Pleasant Watch Live Sky Sporting, Bet
Air Tv, CBS, HD4, FOX, NBC, ESPN TV and 3500+ HD Stations Get the best
online sports coverage on the net directly on your PC, MAC or LAPTOP Click
Here Watch HD Live
Click Here Watch HQ Live Fixture Details Match : Pittsburgh Steelers vs
Washington Redskins live NFL: Preseason Week 2, 2013 DATE: Monday August
19, 2013 TIME: 8:00 PM( ET) Live / Repeat:Live Don't worry,it is too easy
to watch.just try it.
Over 3500 Live Streaming HD Channels Stream Nonstop to your PC or Laptop
No hardware purchases required ever No Monthly charges / No Bandwidth
limits unrestricted worldwide TV Channel coverage No TV restrictions / No
Streaming restrictions Full HD widescreen Playback Support. You all about
US,UK,CAN, AUS, NEZ, Game entertainment like NFL, NCAAF, NFL, MLB, RUGBY,
NASCAR, SOCCER, BOXING, FORMULA ONE, ect by which All of you can watch
each and every games live streaming online. From any location! Get instant
access and most exciting sports coverage stream software online directly
on your PC. Download and install our software and like all the pleasures
of the sporting world comfortably like you are at the stadium watching the
Our software also allows you to watch Pittsburgh Steelers vs Washington
Redskins free Live Game online in perfect HD quality,
How can I *quickly* cycle the a Wifi Network Adapter in Windows 8
How can I *quickly* cycle the a Wifi Network Adapter in Windows 8
Before you close this as a duplicate, please read carefully.
In Windows XP, when there was a problem with Wifi, you could right-click
on the icon, and the context menu allowed you to disable/enable the
network adapter.
In Windows 8 (not sure about 7 since I haven't used a laptop) I need to
search all over for network connections in the Control Panel (well, figure
out network connections is what I want first since this doesn't happen
that often). Then I need to select Wifi with the mouse, and hit Disable
along the top, then make sure Wifi is still selected, then hit Enable
along the top.
The Microsoft help says their troubleshooter will do this automatically -
but, either it does not, or it's giving me the wrong troubleshooter, or
something else is wrong, because running the troubleshooter did not solve
the problem but painstakingly resetting the adapter did (as it always
has).
Is there an easy way to do what I used to do (cycle the adapter quickly),
or at least reset things from the Wifi Metro tab, rather than navigating
all over for the correct Control Panel page?
Thank you.
Before you close this as a duplicate, please read carefully.
In Windows XP, when there was a problem with Wifi, you could right-click
on the icon, and the context menu allowed you to disable/enable the
network adapter.
In Windows 8 (not sure about 7 since I haven't used a laptop) I need to
search all over for network connections in the Control Panel (well, figure
out network connections is what I want first since this doesn't happen
that often). Then I need to select Wifi with the mouse, and hit Disable
along the top, then make sure Wifi is still selected, then hit Enable
along the top.
The Microsoft help says their troubleshooter will do this automatically -
but, either it does not, or it's giving me the wrong troubleshooter, or
something else is wrong, because running the troubleshooter did not solve
the problem but painstakingly resetting the adapter did (as it always
has).
Is there an easy way to do what I used to do (cycle the adapter quickly),
or at least reset things from the Wifi Metro tab, rather than navigating
all over for the correct Control Panel page?
Thank you.
How to switch the GSM/3G module off?
How to switch the GSM/3G module off?
I only use my smartphone (Samsung Galaxy Chat) as a "pocket computer"
(with WiFi) and don't use it to make telephone calls (I use a dual-SIM
"dumbphone" for this). All the time it shows a cellular network signal
indicator and reports that it can make emergency calls. Can I switch it
off to save battery?
Some years ago, when I had a Benefon Esc! GSM+GPS phone, I could
independently turn its GSM and GPS modules on/off. I wonder if this is
possible in modern day smartphones.
I only use my smartphone (Samsung Galaxy Chat) as a "pocket computer"
(with WiFi) and don't use it to make telephone calls (I use a dual-SIM
"dumbphone" for this). All the time it shows a cellular network signal
indicator and reports that it can make emergency calls. Can I switch it
off to save battery?
Some years ago, when I had a Benefon Esc! GSM+GPS phone, I could
independently turn its GSM and GPS modules on/off. I wonder if this is
possible in modern day smartphones.
Sunday, 18 August 2013
Xamarin.. development environment for cross platform app
Xamarin.. development environment for cross platform app
new into the forum, has anyone used Xamarin? if so, what do you think
about the product and it's scalabilty for enterprise solution?
Thanks, A
new into the forum, has anyone used Xamarin? if so, what do you think
about the product and it's scalabilty for enterprise solution?
Thanks, A
add tooltip to extjs grid to show complete information about that row
add tooltip to extjs grid to show complete information about that row
I had a gridview, it attached with a model that have some fields. But in
my grid i just show one field, and what i want is when my mouse hover to
the grid row, tooltip will appear and show the other fields value. How can
i do this? Anybody ever done this?
What grid event that i should create the tooltip? How can i access my on
hover row value and show it on the tooltip? How the nice ways to show the
value, can tooltip using item like xpanel or something, or the only way is
using html? Please help me. Thanks in advance :)
I had a gridview, it attached with a model that have some fields. But in
my grid i just show one field, and what i want is when my mouse hover to
the grid row, tooltip will appear and show the other fields value. How can
i do this? Anybody ever done this?
What grid event that i should create the tooltip? How can i access my on
hover row value and show it on the tooltip? How the nice ways to show the
value, can tooltip using item like xpanel or something, or the only way is
using html? Please help me. Thanks in advance :)
Reading the next line in the file and keeping counts separate
Reading the next line in the file and keeping counts separate
Another question for you everyone. To reiterate I am very new to the Perl
process and I apologize in advance for making silly mistakes
I am trying to calculate the GC content of different lengths of DNA
sequence. The file is in this format:
>gene 1
DNA sequence of specific gene
>gene 2
DNA sequence of specific gene
...etc...
I have established the counter and to read each line of DNA sequence but
at the moment it is do a running summation of the total across all lines.
I want it to read each sequence, print the content after the sequence read
then move onto the next one. Having individual base counts for each line.
This is what I have so far.
#!/usr/bin/perl
#necessary code to open and read a new file and create a new one.
use strict;
my $infile = "Lab1_seq.fasta";
open INFILE, $infile or die "$infile: $!";
my $outfile = "Lab1_seq_output.txt";
open OUTFILE, ">$outfile" or die "Cannot open $outfile: $!";
my $G = (0);
my $C = (0);
my $A = (0);
my $T = (0);
while ( my $line = <INFILE> ) {
chomp $line;
if ($line =~ /^>/){
print "$line\n";
}
if ($line =~ /[A-Z]/){
my @array = split //, $line;
my $array= (@array);
foreach $array (@array){
if ($array eq 'G'){
++$G;
}
elsif ( $array eq 'C' ) {
++$C; }
elsif ( $array eq 'A' ) {
++$A; }
elsif ( $array eq 'T' ) {
++$T; }
}
}
}
print "G:=$G\n";
print "C:=$C\n";
Again I feel like I am on the right path, I am just missing some basic
foundations. Any help would be greatly appreciated.
Another question for you everyone. To reiterate I am very new to the Perl
process and I apologize in advance for making silly mistakes
I am trying to calculate the GC content of different lengths of DNA
sequence. The file is in this format:
>gene 1
DNA sequence of specific gene
>gene 2
DNA sequence of specific gene
...etc...
I have established the counter and to read each line of DNA sequence but
at the moment it is do a running summation of the total across all lines.
I want it to read each sequence, print the content after the sequence read
then move onto the next one. Having individual base counts for each line.
This is what I have so far.
#!/usr/bin/perl
#necessary code to open and read a new file and create a new one.
use strict;
my $infile = "Lab1_seq.fasta";
open INFILE, $infile or die "$infile: $!";
my $outfile = "Lab1_seq_output.txt";
open OUTFILE, ">$outfile" or die "Cannot open $outfile: $!";
my $G = (0);
my $C = (0);
my $A = (0);
my $T = (0);
while ( my $line = <INFILE> ) {
chomp $line;
if ($line =~ /^>/){
print "$line\n";
}
if ($line =~ /[A-Z]/){
my @array = split //, $line;
my $array= (@array);
foreach $array (@array){
if ($array eq 'G'){
++$G;
}
elsif ( $array eq 'C' ) {
++$C; }
elsif ( $array eq 'A' ) {
++$A; }
elsif ( $array eq 'T' ) {
++$T; }
}
}
}
print "G:=$G\n";
print "C:=$C\n";
Again I feel like I am on the right path, I am just missing some basic
foundations. Any help would be greatly appreciated.
Why is my UIButton object don't change origin?
Why is my UIButton object don't change origin?
I create bytton: IBOutlet UIButton *but; and connect it with my xib
button. But when I set origin to my button:
but=[[UIButton alloc] init];
[but setFrame:CGRectMake(50, 100, but.bounds.size.width,
but.bounds.size.height)];
Origin of my button don't change. Wat is reason of it? And How I correct it?
I create bytton: IBOutlet UIButton *but; and connect it with my xib
button. But when I set origin to my button:
but=[[UIButton alloc] init];
[but setFrame:CGRectMake(50, 100, but.bounds.size.width,
but.bounds.size.height)];
Origin of my button don't change. Wat is reason of it? And How I correct it?
Drawing of a legend via grid: No grid object drawn
Drawing of a legend via grid: No grid object drawn
I would like to use grid/gridBase to add a legend to a base graphics. The
following minimal example already contains the first steps towards the
legend (certainly not correct yet), but the legend is not shown. Some
problem with units (?)
myplot <- function(x=1:10)
{
stopifnot(require(grid), require(gridBase))
## layout
opar <- par(no.readonly=TRUE); on.exit(par(opar))
plot.new()
gl <- grid.layout(nrow=2, ncol=3, widths=c(0.1, 0.8, 0.1),
heights=c(0.8, 0.2),
default.units="npc")
pushViewport(viewport(layout=gl))
## points
pushViewport(viewport(layout.pos.row=1, layout.pos.col=2))
par(plt = gridPLT())
par(new=TRUE)
plot.window(xlim=c(1, 10), ylim=c(1, 10))
plot(x, rev(x), col="blue", type="b")
lines(x, x, col="red", type="b")
popViewport()
## legend
pushViewport(viewport(layout.pos.row=2, layout.pos.col=2))
legend <- c("type1", "type2")
cl <- c("blue", "red")
grid.draw(
gTree(pointsGrob(x=1:2, y=c(0.5, 0.5), name="points",
gp=gpar(col=cl, cex=0.55)),
textGrob(legend, just="left", name="text"),
name="legend")
)
popViewport()
## return
invisible(gl)
}
myplot()
I would like to use grid/gridBase to add a legend to a base graphics. The
following minimal example already contains the first steps towards the
legend (certainly not correct yet), but the legend is not shown. Some
problem with units (?)
myplot <- function(x=1:10)
{
stopifnot(require(grid), require(gridBase))
## layout
opar <- par(no.readonly=TRUE); on.exit(par(opar))
plot.new()
gl <- grid.layout(nrow=2, ncol=3, widths=c(0.1, 0.8, 0.1),
heights=c(0.8, 0.2),
default.units="npc")
pushViewport(viewport(layout=gl))
## points
pushViewport(viewport(layout.pos.row=1, layout.pos.col=2))
par(plt = gridPLT())
par(new=TRUE)
plot.window(xlim=c(1, 10), ylim=c(1, 10))
plot(x, rev(x), col="blue", type="b")
lines(x, x, col="red", type="b")
popViewport()
## legend
pushViewport(viewport(layout.pos.row=2, layout.pos.col=2))
legend <- c("type1", "type2")
cl <- c("blue", "red")
grid.draw(
gTree(pointsGrob(x=1:2, y=c(0.5, 0.5), name="points",
gp=gpar(col=cl, cex=0.55)),
textGrob(legend, just="left", name="text"),
name="legend")
)
popViewport()
## return
invisible(gl)
}
myplot()
reference to external xml from xsd
reference to external xml from xsd
i want to check if an attribute is exist in another xml from an xsd i made
for another xml.
for an example i have this xsd
<xs:schema version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="models">
<xs:complexType>
<xs:sequence>
<xs:element name="model" maxOccurs="unbounded" minOccurs="1">
<xs:complexType>
<xs:attribute name="name" type="xs:string"
use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniqueModelName">
<xs:selector xpath="./model"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
and i have another xsd
<xs:element name="language">
<xs:complexType>
<xs:sequence>
<xs:element name="word" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="value" maxOccurs="unbounded"
minOccurs="1">
<xs:complexType>
<xs:attribute name="lange"
type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="key" type="xs:string"
use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
and i want to insure that the attribute named name of the elements named
model in the first xsd are exist in the attribute named key of the element
value in the second xsd
in other words, if there are attributes value named name in the first xsd
doesn't exist in the second xsd, an error must occur.
xml example:
xml for first xsd:
<model name="A"/>
<model name="B"/>
xml for second xsd:
<word key="A">
<value lange="english">Add</value>
<value lange="frensh">ajouter</value>
</word>
it must tell there is an error because there is no tag word in the second
xml that has an attribute B can this happen in xsd :) ?
while this is a correct one
<word key="A">
<value lange="english">Add</value>
<value lange="frensh">ajouter</value>
</word>
<word key="B">
<value lange="english">Add</value>
<value lange="frensh">ajouter</value>
</word>
i want to check if an attribute is exist in another xml from an xsd i made
for another xml.
for an example i have this xsd
<xs:schema version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="models">
<xs:complexType>
<xs:sequence>
<xs:element name="model" maxOccurs="unbounded" minOccurs="1">
<xs:complexType>
<xs:attribute name="name" type="xs:string"
use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniqueModelName">
<xs:selector xpath="./model"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
and i have another xsd
<xs:element name="language">
<xs:complexType>
<xs:sequence>
<xs:element name="word" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="value" maxOccurs="unbounded"
minOccurs="1">
<xs:complexType>
<xs:attribute name="lange"
type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="key" type="xs:string"
use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
and i want to insure that the attribute named name of the elements named
model in the first xsd are exist in the attribute named key of the element
value in the second xsd
in other words, if there are attributes value named name in the first xsd
doesn't exist in the second xsd, an error must occur.
xml example:
xml for first xsd:
<model name="A"/>
<model name="B"/>
xml for second xsd:
<word key="A">
<value lange="english">Add</value>
<value lange="frensh">ajouter</value>
</word>
it must tell there is an error because there is no tag word in the second
xml that has an attribute B can this happen in xsd :) ?
while this is a correct one
<word key="A">
<value lange="english">Add</value>
<value lange="frensh">ajouter</value>
</word>
<word key="B">
<value lange="english">Add</value>
<value lange="frensh">ajouter</value>
</word>
Saturday, 17 August 2013
A package for package-loading management?
A package for package-loading management?
Many packages require loading before/after hyperref or other dependencies.
Is there a package to manage this?
\usepackages{ellipsis,[hidelinks]hyperref,titlesec}
Would, I believe, reverse the order of loading there.
I'm not looking for a package that will analyze what it is loading—more of
something that takes predefined relations and applies them like a package
manager would. Does something like this exist, or is it another
opportunity to show off expl3?
Many packages require loading before/after hyperref or other dependencies.
Is there a package to manage this?
\usepackages{ellipsis,[hidelinks]hyperref,titlesec}
Would, I believe, reverse the order of loading there.
I'm not looking for a package that will analyze what it is loading—more of
something that takes predefined relations and applies them like a package
manager would. Does something like this exist, or is it another
opportunity to show off expl3?
Bind9 DLZ error with samba4
Bind9 DLZ error with samba4
I am following the Samba wiki tutorial to set up Samba4 with Bind9 back
end. I am stuck with this error though, I am assuming the "apt-get install
bind9" does not include dlopen from the Ubuntu repo's so how can i compile
it so it will?
Aug 17 19:14:28 wwdev-DC named[1511]: Loading 'AD DNS Zone' using driver
dlopen
Aug 17 19:14:28 wwdev-DC named[1511]: samba_dlz: Failed to connect to
/var/lib/samba/private/dns/sam.ldb
Aug 17 19:14:28 wwdev-DC named[1511]: dlz_dlopen of 'AD DNS Zone' failed
Aug 17 19:14:28 wwdev-DC named[1511]: SDLZ driver failed to load.
Aug 17 19:14:28 wwdev-DC named[1511]: DLZ driver failed to load.
Aug 17 19:14:28 wwdev-DC named[1511]: loading configuration: failure
Aug 17 19:14:28 wwdev-DC named[1511]: exiting (due to fatal error)
Thanks! Nat
I am following the Samba wiki tutorial to set up Samba4 with Bind9 back
end. I am stuck with this error though, I am assuming the "apt-get install
bind9" does not include dlopen from the Ubuntu repo's so how can i compile
it so it will?
Aug 17 19:14:28 wwdev-DC named[1511]: Loading 'AD DNS Zone' using driver
dlopen
Aug 17 19:14:28 wwdev-DC named[1511]: samba_dlz: Failed to connect to
/var/lib/samba/private/dns/sam.ldb
Aug 17 19:14:28 wwdev-DC named[1511]: dlz_dlopen of 'AD DNS Zone' failed
Aug 17 19:14:28 wwdev-DC named[1511]: SDLZ driver failed to load.
Aug 17 19:14:28 wwdev-DC named[1511]: DLZ driver failed to load.
Aug 17 19:14:28 wwdev-DC named[1511]: loading configuration: failure
Aug 17 19:14:28 wwdev-DC named[1511]: exiting (due to fatal error)
Thanks! Nat
Loadbalance between Heroku and AppHarbor?
Loadbalance between Heroku and AppHarbor?
How would you set up simple redundancy between these 2 "cloud" providers?
Does a DNS fallback seem reasonable (that would update records when one is
down) or would it take too long to propragate the changes?
How would you set up simple redundancy between these 2 "cloud" providers?
Does a DNS fallback seem reasonable (that would update records when one is
down) or would it take too long to propragate the changes?
Restricting users to Internet only (no LAN) on router (RT-N56U and DGL-4300)
Restricting users to Internet only (no LAN) on router (RT-N56U and DGL-4300)
I've been working on this for the past 6 hours and have made no progress.
The setup looks like this:
|Internet|---|Router1|---|Router2|---|LAN1|
|
|
L---|Router3|---LAN2
Problem: I want to restrict Router3 from seeing the other LAN while
maintaining Internet access. Restrictions: Router 1 and 3 are on the 3rd
floor. Router2 is on the first floor. Willing to completely reconfigure
for an elegant solution.
Things I've Tried:
Different combinations of subnets
Plugging Router1 into the LAN port of Router3 (total connectivity loss
behind Router3)
Inserted the following to Router2's /etc/storage/post_iptables_script.sh:
iptables -I FORWARD -m mac --mac-source 00:00:00:00:00:00 -j DROP (Where
00:00:00:00:00:00 is Router3's MAC address)
Router Information:
Router1:
Model: DGL-4300
IP: 10.1.1.11
Subnet: 255.255.255.0
Router2:
Model: RT-N56U
IP: 10.1.1.1
Subnet: 255.255.255.0
Router3:
Model: DGL-4300
WAN IP: 10.1.1.200
WAN Subnet: 255.255.255.0
LAN IP: 192.168.0.1
LAN Subnet: 255.255.255.0
I've been working on this for the past 6 hours and have made no progress.
The setup looks like this:
|Internet|---|Router1|---|Router2|---|LAN1|
|
|
L---|Router3|---LAN2
Problem: I want to restrict Router3 from seeing the other LAN while
maintaining Internet access. Restrictions: Router 1 and 3 are on the 3rd
floor. Router2 is on the first floor. Willing to completely reconfigure
for an elegant solution.
Things I've Tried:
Different combinations of subnets
Plugging Router1 into the LAN port of Router3 (total connectivity loss
behind Router3)
Inserted the following to Router2's /etc/storage/post_iptables_script.sh:
iptables -I FORWARD -m mac --mac-source 00:00:00:00:00:00 -j DROP (Where
00:00:00:00:00:00 is Router3's MAC address)
Router Information:
Router1:
Model: DGL-4300
IP: 10.1.1.11
Subnet: 255.255.255.0
Router2:
Model: RT-N56U
IP: 10.1.1.1
Subnet: 255.255.255.0
Router3:
Model: DGL-4300
WAN IP: 10.1.1.200
WAN Subnet: 255.255.255.0
LAN IP: 192.168.0.1
LAN Subnet: 255.255.255.0
mkdir always creates a file instead a directory
mkdir always creates a file instead a directory
First I want to say that I don't really know what I should look for, here
in Stack Overflow and what could be a good query for my problem.
In simple words I want to create a new directory and than do some file
operations in it. But with the script that I have crafted I got always a
file instead of a directory. It seems to be absolutely regardless how I
stick the code together there is always the same result. I hope tat masses
can help me with their knowledge.
Here is the script:
#!/bin/bash
DLURL=http://drubuntu.googlecode.com/git'
d7dir=/var/www/d7/'
dfsettings=/var/www/d7/sites/default/default.settings.php
settings=/var/www/d7/sites/default/settings.php
#settiing up drush
drush -y dl drush --destination=/usr/share;
#Download and set up drupal
cd /var/www/;
drush -y dl drupal;
mkdir "$d7dir"; #this is the line that always produces a file instead a
directory
# regardless if it is replaced by the variable or entered as
# /var/www/d7
cd /var/www/drup*;
cp .htaccess .gitignore "$d7dir";
cp -r * "$d7dir";
cd "$d7dir";
rm -r /var/www/drup*;
mkdir "$d7dir"sites/default/files;
chmod 777 "$d7dir"sites/default/files;
cp "$dfsettings" "$settings";
chmod 777 "$settings";
chown $username:www-data /var/www/d7/.htaccess;
wget -O $d7dir"setupsite $DLURL/scripts/setupsite.sh; > /dev/null 2>&1
chmod +x /var/www/setupsite;
echo "Login Details following...";
read -sn 1 -p "Press any key to continue...";
bash "$d7dir"setupsite;
chown -Rh $username:www-data /var/www;
chmod 644 $d7dir".htaccess;
chmod 644"$settings";
chmod 644"$dfsettings";
exit
I hope someone got the reason for that.
First I want to say that I don't really know what I should look for, here
in Stack Overflow and what could be a good query for my problem.
In simple words I want to create a new directory and than do some file
operations in it. But with the script that I have crafted I got always a
file instead of a directory. It seems to be absolutely regardless how I
stick the code together there is always the same result. I hope tat masses
can help me with their knowledge.
Here is the script:
#!/bin/bash
DLURL=http://drubuntu.googlecode.com/git'
d7dir=/var/www/d7/'
dfsettings=/var/www/d7/sites/default/default.settings.php
settings=/var/www/d7/sites/default/settings.php
#settiing up drush
drush -y dl drush --destination=/usr/share;
#Download and set up drupal
cd /var/www/;
drush -y dl drupal;
mkdir "$d7dir"; #this is the line that always produces a file instead a
directory
# regardless if it is replaced by the variable or entered as
# /var/www/d7
cd /var/www/drup*;
cp .htaccess .gitignore "$d7dir";
cp -r * "$d7dir";
cd "$d7dir";
rm -r /var/www/drup*;
mkdir "$d7dir"sites/default/files;
chmod 777 "$d7dir"sites/default/files;
cp "$dfsettings" "$settings";
chmod 777 "$settings";
chown $username:www-data /var/www/d7/.htaccess;
wget -O $d7dir"setupsite $DLURL/scripts/setupsite.sh; > /dev/null 2>&1
chmod +x /var/www/setupsite;
echo "Login Details following...";
read -sn 1 -p "Press any key to continue...";
bash "$d7dir"setupsite;
chown -Rh $username:www-data /var/www;
chmod 644 $d7dir".htaccess;
chmod 644"$settings";
chmod 644"$dfsettings";
exit
I hope someone got the reason for that.
Need help to create macro, which will combine each cell in col A with all non empty cells in col B. All the inputs are variable
Need help to create macro, which will combine each cell in col A with all
non empty cells in col B. All the inputs are variable
first input Col A: (variable rows/data) 100114 100119 100935
second input(variable rows/data) Col B: 0001FVT1444 0001TBL3885
0001PCU3885 0001TPE3885 0001HNG3885 0001FVT14R4
output Col C: 1001140001FVT1444 1001140001TBL3885 1001140001PCU3885
1001140001TPE3885 1001140001HNG3885 1001140001FVT14R4 1001190001FVT1444
1001190001TBL3885 1001190001PCU3885 1001190001TPE3885 1001190001HNG3885
1001190001FVT14R4 1009350001FVT1444 1009350001TBL3885 1009350001PCU3885
1009350001TPE3885 1009350001HNG3885 1009350001FVT14R4
Thanks
non empty cells in col B. All the inputs are variable
first input Col A: (variable rows/data) 100114 100119 100935
second input(variable rows/data) Col B: 0001FVT1444 0001TBL3885
0001PCU3885 0001TPE3885 0001HNG3885 0001FVT14R4
output Col C: 1001140001FVT1444 1001140001TBL3885 1001140001PCU3885
1001140001TPE3885 1001140001HNG3885 1001140001FVT14R4 1001190001FVT1444
1001190001TBL3885 1001190001PCU3885 1001190001TPE3885 1001190001HNG3885
1001190001FVT14R4 1009350001FVT1444 1009350001TBL3885 1009350001PCU3885
1009350001TPE3885 1009350001HNG3885 1009350001FVT14R4
Thanks
Cache issue / conflict with mobile & desktop themes - Magento Community 1.7
Cache issue / conflict with mobile & desktop themes - Magento Community 1.7
We're using Magento Community version 1.7 and have a standard desktop
theme and a mobile theme. We've added matched expressions to the General >
Design > Themes section to display the relevant theme based on browser
user agent.
Everything works great when the cache is switched off. However, when the
cache is switched on and cleared, the theme which is loaded first gets
cached. Is there a way around this? Either creating a separate cache for
each theme or even switching the cache off altogether for the mobile
theme?
Many thanks in advance for any advice you can give.
We're using Magento Community version 1.7 and have a standard desktop
theme and a mobile theme. We've added matched expressions to the General >
Design > Themes section to display the relevant theme based on browser
user agent.
Everything works great when the cache is switched off. However, when the
cache is switched on and cleared, the theme which is loaded first gets
cached. Is there a way around this? Either creating a separate cache for
each theme or even switching the cache off altogether for the mobile
theme?
Many thanks in advance for any advice you can give.
Friday, 16 August 2013
VB.net link extraction using HtmlAgilityPack
VB.net link extraction using HtmlAgilityPack
My program does extract the links from any specified html but the problem
is that it won't display the complete URL.
Dim htmlDoc As New HtmlAgilityPack.HtmlDocument()
htmlDoc.LoadHtml(WebSource)
For Each link As HtmlNode In htmlDoc.DocumentNode.SelectNodes("//cite")
If link.InnerText.Contains("index.php") Then
ListBox1.Items.Add(link.InnerText)
End If
Next
My expected output should be:
http://www.site1.com/index.php/test/sample_test
http://www.site2.com/index.php/aaaa/bbbbb/sssss
http://www.site3.com/index.php/zzzz_z/ssss_f
http://www.site4.com/index.php/teest/
http://www.site5.com/index.php/sample_url/test=1
but it displays a broken URL with dots, for example this URL:
http://www.site5.com/index.php/sample_url/test=1
the actual output looks like this:
http://www.site5.com/index.php...test..1
What seems to be causing this? I am really confused.
My program does extract the links from any specified html but the problem
is that it won't display the complete URL.
Dim htmlDoc As New HtmlAgilityPack.HtmlDocument()
htmlDoc.LoadHtml(WebSource)
For Each link As HtmlNode In htmlDoc.DocumentNode.SelectNodes("//cite")
If link.InnerText.Contains("index.php") Then
ListBox1.Items.Add(link.InnerText)
End If
Next
My expected output should be:
http://www.site1.com/index.php/test/sample_test
http://www.site2.com/index.php/aaaa/bbbbb/sssss
http://www.site3.com/index.php/zzzz_z/ssss_f
http://www.site4.com/index.php/teest/
http://www.site5.com/index.php/sample_url/test=1
but it displays a broken URL with dots, for example this URL:
http://www.site5.com/index.php/sample_url/test=1
the actual output looks like this:
http://www.site5.com/index.php...test..1
What seems to be causing this? I am really confused.
Thursday, 8 August 2013
Making app compatible with tablets
Making app compatible with tablets
Well I have this app that have an option to read device sms and missed
calls. This is not a needed feature, but its present. The problem is that
I have this permissions:
<uses-permission android:name="android.permission.READ_CONTACTS">
</uses-permission >
<uses-permission android:name="android.permission.RECEIVE_SMS">
</uses-permission >
<uses-permission android:name="android.permission.READ_SMS">
</uses-permission >
<uses-permission android:name="android.permission.READ_PHONE_STATE">
</uses-permission >
And I'm sure that some of them are making the app incompatible with
tablets, so I tried to change it to:
<uses-feature android:name="android.permission.READ_CONTACTS"
android:required="false">
</uses-feature>
<uses-feature android:name="android.permission.RECEIVE_SMS"
android:required="false">
</uses-feature>
<uses-feature android:name="android.permission.READ_SMS"
android:required="false">
</uses-feature>
<uses-feature android:name="android.permission.READ_PHONE_STATE"
android:required="false">
</uses-feature>
But now the app wont show the sms when running in a phone. Is there
anything else that I should include in order to make it work?
Thanks
Well I have this app that have an option to read device sms and missed
calls. This is not a needed feature, but its present. The problem is that
I have this permissions:
<uses-permission android:name="android.permission.READ_CONTACTS">
</uses-permission >
<uses-permission android:name="android.permission.RECEIVE_SMS">
</uses-permission >
<uses-permission android:name="android.permission.READ_SMS">
</uses-permission >
<uses-permission android:name="android.permission.READ_PHONE_STATE">
</uses-permission >
And I'm sure that some of them are making the app incompatible with
tablets, so I tried to change it to:
<uses-feature android:name="android.permission.READ_CONTACTS"
android:required="false">
</uses-feature>
<uses-feature android:name="android.permission.RECEIVE_SMS"
android:required="false">
</uses-feature>
<uses-feature android:name="android.permission.READ_SMS"
android:required="false">
</uses-feature>
<uses-feature android:name="android.permission.READ_PHONE_STATE"
android:required="false">
</uses-feature>
But now the app wont show the sms when running in a phone. Is there
anything else that I should include in order to make it work?
Thanks
Sublime Text 2 HTML5 Syntax Not Underlining Matching Tags
Sublime Text 2 HTML5 Syntax Not Underlining Matching Tags
I'm not aware of changing any settings that would have caused this, but
for some reason, when the language type is set as HTML5, Sublime has
stopped displaying an underline beneath matching tags. I've grown
accustomed to this feature in any editor I use, and I've come to rely on
it to catch unclosed tags.
When the language type is set to HTML, the underlining behaves normally.
Only when HTML5 is the language is there a problem.
As HTML5 is the default language type (by choice) for several languages
that I program in, this is quite inconvenient.
Does anyone know where I can look to alter this?
It doesn't appear to be theme related, as it behaves similarly across
themes, and the HTML underlining will work with the same theme that it
isn't working in HTML5.
I'm not aware of changing any settings that would have caused this, but
for some reason, when the language type is set as HTML5, Sublime has
stopped displaying an underline beneath matching tags. I've grown
accustomed to this feature in any editor I use, and I've come to rely on
it to catch unclosed tags.
When the language type is set to HTML, the underlining behaves normally.
Only when HTML5 is the language is there a problem.
As HTML5 is the default language type (by choice) for several languages
that I program in, this is quite inconvenient.
Does anyone know where I can look to alter this?
It doesn't appear to be theme related, as it behaves similarly across
themes, and the HTML underlining will work with the same theme that it
isn't working in HTML5.
Android Cursor? how to read object data?
Android Cursor? how to read object data?
i know a Cursor has method for get String, Int, etc but isn't there
somethings as
mycursor.GetObject(index)
I want to create a dinamic method which return a object and I only cast it.
or is it posible use mycursor.GetString(index) for any type?
String,Float,Double,Long,Short, Blob,Int,etc
and I can use for example for a Flot or a Int or any type and cast it?
for example
(Blob) newblob=mycursor.GetString(i_return_BloB);
(Int) newint=mycursor.GetString(i_return_Int);
(Float) newfloat=mycursor.GetString(i_return_Float);
(Double) newdouble=mycursor.GetString(i_return_Double);
(Long) newlong=mycursor.GetString(i_return_long);
(Short) newshort=mycursor.GetString(i_return_short);
would it work? could i use mycursor.GetString for any type?
i know a Cursor has method for get String, Int, etc but isn't there
somethings as
mycursor.GetObject(index)
I want to create a dinamic method which return a object and I only cast it.
or is it posible use mycursor.GetString(index) for any type?
String,Float,Double,Long,Short, Blob,Int,etc
and I can use for example for a Flot or a Int or any type and cast it?
for example
(Blob) newblob=mycursor.GetString(i_return_BloB);
(Int) newint=mycursor.GetString(i_return_Int);
(Float) newfloat=mycursor.GetString(i_return_Float);
(Double) newdouble=mycursor.GetString(i_return_Double);
(Long) newlong=mycursor.GetString(i_return_long);
(Short) newshort=mycursor.GetString(i_return_short);
would it work? could i use mycursor.GetString for any type?
Nested dictionary in python
Nested dictionary in python
Hi This is my first question on Stack Overflow. I have the following data
where first column are ID, second column are category, third column is
items and fourth column is price. I am try to find each ID's spend sum by
category(column2 from left): A sample output will be: like below. However,
I am stuck on the elif statement and says it has keyError:'A': I really do
not know what is wrong. If anyone knows please help me out. Thanks very
much.
***sample output***
Spending by B fuel - 19.60 grocery - 11.42
A|groceries|cereal|15.50 A|groceries|milk|14.75 A|tobacco|cigarettes|25.00
A|fuel|gasoline|54.90 B|fuel|propane|19.60 B|groceries|apple|11.42
C|tobacco|cigarettes|25.00
for line in fileinput.input(fo1):
#print line
line =str.rstrip(line)
line = line.split('|')
print line[0],line[1]
(name,category,items,price)=line
if line[0] in report2 and line[1] in report2:
report2[line[0]][line[1]] += float(price)
elif line[1] in report2[line[0]]:
report2[line[0]][line[1]]+=float(price)
else:
report2[line[0]][line[1]]=float(price)
print report2.keys
print report2.items()
Hi This is my first question on Stack Overflow. I have the following data
where first column are ID, second column are category, third column is
items and fourth column is price. I am try to find each ID's spend sum by
category(column2 from left): A sample output will be: like below. However,
I am stuck on the elif statement and says it has keyError:'A': I really do
not know what is wrong. If anyone knows please help me out. Thanks very
much.
***sample output***
Spending by B fuel - 19.60 grocery - 11.42
A|groceries|cereal|15.50 A|groceries|milk|14.75 A|tobacco|cigarettes|25.00
A|fuel|gasoline|54.90 B|fuel|propane|19.60 B|groceries|apple|11.42
C|tobacco|cigarettes|25.00
for line in fileinput.input(fo1):
#print line
line =str.rstrip(line)
line = line.split('|')
print line[0],line[1]
(name,category,items,price)=line
if line[0] in report2 and line[1] in report2:
report2[line[0]][line[1]] += float(price)
elif line[1] in report2[line[0]]:
report2[line[0]][line[1]]+=float(price)
else:
report2[line[0]][line[1]]=float(price)
print report2.keys
print report2.items()
Negative Margin in Firefox Using Bootstrap
Negative Margin in Firefox Using Bootstrap
I am using Twitter Bootstrap plugin, mainly just the grid system currently.
I am trying to put one row on top of another doing some stuff for
responsive design.
In Chrome this works perfectly:
<div class="container">
<div class="row">
<div class="content">
abcd
</div>
</div>
<div class="row" id="moveUpRow">
<div class="content">
efgh
</div>
</div>
</div>
CSS:
.row {
height: 200px;
}
#moveUpRow {
margin-top: -200px;
}
But in Firefox and IE they both ignore the negative margin. I have tried
top: -200px, but that just moves up the row and not all of the elements
below the row. Leaving big white space.
Any other solutions to this problem? Or any suggestions on how to "pull"
up any content below the row?
I am using Twitter Bootstrap plugin, mainly just the grid system currently.
I am trying to put one row on top of another doing some stuff for
responsive design.
In Chrome this works perfectly:
<div class="container">
<div class="row">
<div class="content">
abcd
</div>
</div>
<div class="row" id="moveUpRow">
<div class="content">
efgh
</div>
</div>
</div>
CSS:
.row {
height: 200px;
}
#moveUpRow {
margin-top: -200px;
}
But in Firefox and IE they both ignore the negative margin. I have tried
top: -200px, but that just moves up the row and not all of the elements
below the row. Leaving big white space.
Any other solutions to this problem? Or any suggestions on how to "pull"
up any content below the row?
Simple Java Program Strange Output
Simple Java Program Strange Output
This is my program...
import java.lang.Math;
class SquareRoot
{
public static void main(String args[])
{
try
{
System.out.println("Enter A Number To Find its Square Root");
System.out.flush();
double x = (double) System.in.read();
double y;
y = Math.sqrt(x);
System.out.println("Square Root of " + x + " is " + y);
}
catch (Exception e)
{
System.out.println("I/O Error! Humein Maaf Kar Do Bhaaya");
}
}
}
If I enter 75 as input it shows.. Square Root of 55.0 is <55's square root>
On entering 23 it shows Square Root of 50.0. Where am I wrong? No problems
in compilation.
I am using DrJava IDE. JDK 7u25 Compiler. Windows 7 32 bit.
This is my program...
import java.lang.Math;
class SquareRoot
{
public static void main(String args[])
{
try
{
System.out.println("Enter A Number To Find its Square Root");
System.out.flush();
double x = (double) System.in.read();
double y;
y = Math.sqrt(x);
System.out.println("Square Root of " + x + " is " + y);
}
catch (Exception e)
{
System.out.println("I/O Error! Humein Maaf Kar Do Bhaaya");
}
}
}
If I enter 75 as input it shows.. Square Root of 55.0 is <55's square root>
On entering 23 it shows Square Root of 50.0. Where am I wrong? No problems
in compilation.
I am using DrJava IDE. JDK 7u25 Compiler. Windows 7 32 bit.
SSIS Performance drop when adding parameters
SSIS Performance drop when adding parameters
I'm using an OLE DB Source in SSIS to pull data rows from a SQL Server
2012 database:
SELECT item_prod.wo_id, item_prod.oper_id, item_prod.reas_cd,
item_prod.lot_no, item_prod.item_id, item_prod.user_id, item_prod.seq_no,
item_prod.spare1, item_prod.shift_id, item_prod.ent_id,
item_prod.good_prod, item_cons.lot_no as raw_lot_no, item_cons.item_id as
rm_item_id, item_cons.qty_cons
FROM item_prod
LEFT OUTER JOIN item_cons on item_cons.wo_id=item_prod.wo_id AND
item_cons.oper_id=item_prod.oper_id AND item_cons.seq_no=item_prod.seq_no
AND item_prod.lot_no=item_cons.fg_lot_no
This works great, and is able to pull around 1 million rows per minute
currently. A left outer join is used instead of a lookup due to much
better performance when using no cache, and both tables may contain
upwards of 40 million rows.
We need the query to only pull rows that haven't been pulled in a previous
run. The last run row_id gets stored in a variable and put at the end of
the above query:
WHERE item_prod.row_id > ?
On the first run, the parameter will be -1 (to parse everything).
Performance drops between 5-10x by adding the where clause (1 million rows
per 5-10 minutes). What is causing such a significant performance drop,
and is there a way to optimize it?
I'm using an OLE DB Source in SSIS to pull data rows from a SQL Server
2012 database:
SELECT item_prod.wo_id, item_prod.oper_id, item_prod.reas_cd,
item_prod.lot_no, item_prod.item_id, item_prod.user_id, item_prod.seq_no,
item_prod.spare1, item_prod.shift_id, item_prod.ent_id,
item_prod.good_prod, item_cons.lot_no as raw_lot_no, item_cons.item_id as
rm_item_id, item_cons.qty_cons
FROM item_prod
LEFT OUTER JOIN item_cons on item_cons.wo_id=item_prod.wo_id AND
item_cons.oper_id=item_prod.oper_id AND item_cons.seq_no=item_prod.seq_no
AND item_prod.lot_no=item_cons.fg_lot_no
This works great, and is able to pull around 1 million rows per minute
currently. A left outer join is used instead of a lookup due to much
better performance when using no cache, and both tables may contain
upwards of 40 million rows.
We need the query to only pull rows that haven't been pulled in a previous
run. The last run row_id gets stored in a variable and put at the end of
the above query:
WHERE item_prod.row_id > ?
On the first run, the parameter will be -1 (to parse everything).
Performance drops between 5-10x by adding the where clause (1 million rows
per 5-10 minutes). What is causing such a significant performance drop,
and is there a way to optimize it?
403 error while posting to Sharepoint REST social API
403 error while posting to Sharepoint REST social API
I am having a problem with Sharepoint Rest social API. Here's the code to
like a post I got from googling around
function likePost() {
var postId =
'1.0f435d74164149cfa76e19ad21dc7c2e.8a7874906a9348189f2fb83295b598d5.06ff4087162c48dcb43828e4ddf82c38.98b9fc73d5224265b039586688b15b98.8ec3fc561f084e6b98bfb117e9c23022.64.64.1';
$.ajax( {
url: "/_api/social.feed/Post/Like",
type: "POST",
headers: {
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
},
data: JSON.stringify({
'ID': postId
}),
success: function (data) {
alert("Success");
var jsonObject = data.d.ID;
alert(jsonObject);
},
error: function (xhr, ajaxOptions, thrownError) {
alert("POST error:\n" + xhr.status + "\n" + thrownError);
}
});
}
However when I try this on my Sharepoint site, I always get 403 FORBIDDEN
error. Any help would be appreciated.
I am having a problem with Sharepoint Rest social API. Here's the code to
like a post I got from googling around
function likePost() {
var postId =
'1.0f435d74164149cfa76e19ad21dc7c2e.8a7874906a9348189f2fb83295b598d5.06ff4087162c48dcb43828e4ddf82c38.98b9fc73d5224265b039586688b15b98.8ec3fc561f084e6b98bfb117e9c23022.64.64.1';
$.ajax( {
url: "/_api/social.feed/Post/Like",
type: "POST",
headers: {
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
},
data: JSON.stringify({
'ID': postId
}),
success: function (data) {
alert("Success");
var jsonObject = data.d.ID;
alert(jsonObject);
},
error: function (xhr, ajaxOptions, thrownError) {
alert("POST error:\n" + xhr.status + "\n" + thrownError);
}
});
}
However when I try this on my Sharepoint site, I always get 403 FORBIDDEN
error. Any help would be appreciated.
Can I obtain a pointer to a map value in golang?
Can I obtain a pointer to a map value in golang?
I'm trying to use Go's flag package to dynamically generate FlagSets and
collect the results in a map from flagname -> flag value.
My code looks like this:
import "flag"
fs := flag.NewFlagSet(strings.Join(commands, " "), flag.ExitOnError)
requiredFlags := []string{"flagA", "flagB"}
flags := make(map[string]string)
for _, f := range requiredFlags {
flags[f] = *fs.String(f, "", "")
}
This code compiles, but the map never gets updated after the FlagSet fs is
parsed, so the values of "flagA" and "flagB" are both "". So this makes
sense to me; flags is of type map[string]string after all, not
map[string]*string. Unfortunately, I can't seem to fix this problem using
pointers. I've tried every combination of referencing and dereferencing I
can think of and I either end up with a nil pointer dereference (runtime
error) or invalid indirect (compile time error).
How can I set up the map and FlagSet such that the map values are
populated after the FlagSet is parsed?
I'm trying to use Go's flag package to dynamically generate FlagSets and
collect the results in a map from flagname -> flag value.
My code looks like this:
import "flag"
fs := flag.NewFlagSet(strings.Join(commands, " "), flag.ExitOnError)
requiredFlags := []string{"flagA", "flagB"}
flags := make(map[string]string)
for _, f := range requiredFlags {
flags[f] = *fs.String(f, "", "")
}
This code compiles, but the map never gets updated after the FlagSet fs is
parsed, so the values of "flagA" and "flagB" are both "". So this makes
sense to me; flags is of type map[string]string after all, not
map[string]*string. Unfortunately, I can't seem to fix this problem using
pointers. I've tried every combination of referencing and dereferencing I
can think of and I either end up with a nil pointer dereference (runtime
error) or invalid indirect (compile time error).
How can I set up the map and FlagSet such that the map values are
populated after the FlagSet is parsed?
Wednesday, 7 August 2013
Creating a browser Exit popup
Creating a browser Exit popup
What I want to do is detecting the browser close event(on browser unload)
and open up a new pop up where we have some options like (give a feedback,
go to the page again , mail me a report etc). At the same time I want the
parent window alive till the user select an option in pop up window. I
tried following and it seems not working.
$(window).bind('beforeunload', function(event){
event.preventDefault();
});
Please give me the right direction for achieving this.
What I want to do is detecting the browser close event(on browser unload)
and open up a new pop up where we have some options like (give a feedback,
go to the page again , mail me a report etc). At the same time I want the
parent window alive till the user select an option in pop up window. I
tried following and it seems not working.
$(window).bind('beforeunload', function(event){
event.preventDefault();
});
Please give me the right direction for achieving this.
Subscribe to:
Comments (Atom)