Saturday, 31 August 2013

Deleting a node from a Binary Tree Search

Deleting a node from a Binary Tree Search

I think there are multiple errors in my code for deleting a node from a
BST. I just can't figure out what! Here's my code. Thanks in advance!
void del(int val){
help = root;
f = help;
while (help){
if(help->data==val) break;
f = help;
if (val > help-> data) help = help->right;
else help = help->left;
} if(help->data != val) printf("\nElement not found!");
else{
printf("Element found!");
target = help;
if(val>f->data){
if(target->right && !target->left) {f->right = target->right;
f = target->right;}
else {f->right = target->left; f = target->left;}
} else{
if(target->right && !target->left) {f->left = target->right; f
= target->right;}
else {f->left = target->left; f = target->left;}
}
while(help ->right) help = help->right;
if(help->left) help = help->left;
f->right = help;
free(target);
}
}

How do I get a full page background in IE8?

How do I get a full page background in IE8?

How do I get a full page background in IE8? it works fine in firefox and
chrome. I specified the background of a 1000px div. But I am open to
specifying the background of the body or html. Thanks for your time.
Steven
<!doctype html>
<html>
<style>
html {
}
div.whole{width="1000px";margin:0 auto;border-style:solid;
border-width:0px;height:100%;padding:0px;
background: url(images/parchment.png) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
html, body {
margin: 0px;
padding: 0px;
border: 0px;
height:100%;
width:100%
}
div.image{position:relative; top:50px;left:900px;width:300px;
border-style:solid;border-width:0px;}
@font-face
{
font-family: myFirstFont;
src: url(pachs___.ttf);
}
div.text{position:relative;left:250px;top:-300px; font-family:myFirstFont;
font-size:250%;border-style:solid;border-width:1px;
width:600px;}
</style>
<body>
<div class="whole">
<div class="image">
<img src="images/tran.png" width="282px" height="381px" class="tran">
</div>
</div>
</body>
</html>

This imacros code does not work

This imacros code does not work

Source code where program need to input data:
Code that iMacros uses to input data(that works):
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:frm-submit ATTR=ID:last_name
CONTENT=english
Source code where program need to input data:
Code that iMacros uses to input data(doesn't work):
TAG POS=1 TYPE=INPUT:TYPE FORM=tel:frm-submit ATTR=PHONE:phoneNumber
CONTENT=3463475233

Delaying Email or Text Event

Delaying Email or Text Event

I know you're not allowed to send an email or sms text without notifying
the user, but is there a way to delay sending a email or text or maybe
even sending a text or email at a certain time under the user's
discretion? So for example, you give the user an option to send an email
or sms to themselves, and if they choose to, they choose a time each day
they want it sent. Is there a way to make it so that they recieve and
email or text at the time they chose everyday?

Saving image file to sdcard not shown on picture gallery as3

Saving image file to sdcard not shown on picture gallery as3

After saving an image file to sdcard refresh gallery is needed. The saved
image will not be shown until device restart or sdcard rescan. I found an
as3 extension refreshgallery but i dont know how to use it Does someone
used that extension and can post a simple code? Thanks

Unable to send json data using durandal JS using Knockout Binding

Unable to send json data using durandal JS using Knockout Binding

var xyz= {
a: ko.observable(),
b: ko.observable(),
c: ko.observable(),
d: ko.observable()
};
function setupControlEvents()
{
$("#save").on("click",handleSave);
}
function handleSave()
{
var data = ko.toJSON(xyz);
//alert("data to send "+data);
//var d = serializer.serialize(data);
url ="../save";
http.post(url,data).then(function(){
alert("success");
console("save was success");
});
I am able to get the data but unable to save .. when i alert the data that
i am sending i get this data to send
{"a":"A","b":"B","c":"C","d":"D","observable":{"full":true}}
i tried to serialize with durandal's serialize.serialize() but still not
working .. i think i am unable to send the data because i am getting
obserbvable in json data so please kindly help me to solve this..

Friday, 30 August 2013

launching multiple applications using Parallel::ForkManager

launching multiple applications using Parallel::ForkManager

I am using perl's Parallel::ForkManager to launch multiple applications in
parallel. I have two subroutines, one for launching the application and
other for performing data processing on the output files generated as a
result of the application's complete run. In the first subroutine, I make
a system() call to cd to the desired directory and launch the application
there. I call the second subroutine inside the first subroutine after the
system() call. The problem is that after all the runs are launched, the
program exits and the data processing that is done by the 2nd subroutine
never gets completed, all I have are the output files of the application
that appear after the runs are completed in the background.
here is my code of what I am doing
#!/usr/bin/perl -w
use strict;
use Parallel::ForkManager;
use Getopt::Long;
# Get input from the command line. Also get max_no_processes for
Parallel::ForkManager
# Perform operations on the input file and seperate out data from them in
form of arrays.
# The arrays thus formed contain arguments for the application and
path_to_directory where operation is to be performed
my $pm = new Parallel::ForkManager($max_no_processes);
for (my $i = 0; $i < $#input; $i++){ #----> @input is the array
containing the input for the application. using its length as max value.
$pm->start and next;
&subroutine1( $input[$i], $path_to_directory[$i] );
$pm->finish;
}
$pm->wait_all_children;
sub subroutine1{
my($input, $dir) = @_;
system("cd dir && APPLICAION -$input");
&subroutine2($dir);
}
sub subroutin2{
my ($dir) = @_;
# data processing
# print to stdout and file
}

Thursday, 29 August 2013

Meaning of Regular Expression with JS and PHP

Meaning of Regular Expression with JS and PHP

Can anybody explain me the use of this Regular Expression?
I want to truncate characters which has Ascii code less than 32 except
Horizontal Tab, Line Feed and Carriage Return.
Does below code will work accordingly? or Do I need to change it?
JavaScript Code:
var text = text.replace(/[\x00-\x09\x0A\x0D-\x2F]+/, "");
PHP Code
$val = preg_replace('/[\x00-\x09\x0A\x0D-\x2F]/', '',$val);
Edit
I want to preserve LF, HT and CR and not want to truncate them from String
if any. Other characters below Ascii 32 should be Truncated.

How to get all buttons and labels under splitContainer.Panel2

How to get all buttons and labels under splitContainer.Panel2

I want to get the background color of all buttons and labels under
splitContainer.Panel2. When I try it I discover I not success to run on
any control (under Panel2) I try this code:
foreach (Control c in ((Control)splitContainer.Panel2).Controls)
{
MessageBox.Show("Name: " + c.Name + " Back Color: " + c.BackColor);
}
How can I get all background colors of all labels and buttons under
splitContainer.Panel2 ?
EDIT:
I get only this meesage: "Name: panel_Right Back Color: Color [Transparent]"

Facebook Login using Javascript SDK in Chrome browse

Facebook Login using Javascript SDK in Chrome browse

I use javascript SDK in py web application and when i try login through
facebook in FF all ok but if I try login in Chrome nothing was happen and
I see error in console: "FB.login() called before FB.init(). ". Can you
help me?

Wednesday, 28 August 2013

C inserting string into char pointer

C inserting string into char pointer

Hi all I trying to assign string into a char * pointer. Below is how I am
doing but I am getting this warning: assignment makes integer from pointer
without a cast.
What is the correct why to deal with strings in C ?
char* protoName = "";
if(h->extended_hdr.parsed_pkt.l3_proto==0)
*protoName = "HOPOPT";
else if(h->extended_hdr.parsed_pkt.l3_proto==1)
*protoName = "ICMP";
else if(h->extended_hdr.parsed_pkt.l3_proto==2)
*protoName = "IGMP";
else if(h->extended_hdr.parsed_pkt.l3_proto==3)
*protoName = "IGMP";
else if(h->extended_hdr.parsed_pkt.l3_proto==4)
*protoName = "IGMP";
char all[500];
sprintf(all,"IPv4','%s'",* protoName);

Delete from subquery

Delete from subquery

I am using Hibernate in my application. Currently I am trying to execute
the following query:
DELETE FROM ActiveTimes a WHERE
a.begin>=:from AND a.begin<=:to
AND a.end>=:from AND a.end<=:to
AND a in(
SELECT al FROM ActiveTimes al
JOIN al.source.stage st
JOIN st.level.dataSource ds
WHERE ds=:dataSource)
But I get an error: Column 'id' in field list is ambiguous. This feels
normal, because the created SQL query looks like this:
delete
from
active_times
where
begin>=?
and begin<=?
and end>=?
and end<=?
and (
id in (
select
id
from
active_times activeti1_
inner join
sources sourc2_
on activeti1_.source=sourc2_.id
inner join
stage stage3_
on sourc2_.id=stage3_.source
inner join
levels levels4_
on stage3_.level=levels4_.id
inner join
datasources datasource5_
on levels4_.data_source=datasource5_.id
where
id=?
)
)
If I change the query to:
DELETE FROM ActiveTimes a WHERE
a.begin>=:from AND a.begin<=:to
AND a.end>=:from AND a.end<=:to
AND a.id in(
SELECT al.id FROM ActiveTimes al
JOIN al.source.stage st
JOIN st.level.dataSource ds
WHERE ds.id=:dataSource)
I get another error: You can't specify target table 'active_times' for
update in FROM clause.
I am not very experimented with JPQL(or HQL) so I do not understand why
the query looks like that in the first example.
The new error occurs because apparently I cannot make a subquery on the
delete table in MySQL.
Do you have any suggestions on how can I rewrite one of the above queries
in order to make it work?

Printing all matches in a line using regular expression in awk

Printing all matches in a line using regular expression in awk

Say i have a line:
Terminal="123" Pwd="567"
I want to select only number portion using awk
awk 'match($1, /[0-9]+/){print substr($1, RSTART, RLENGTH)};match($2,
/[0-9]+/){print
substr($2, RSTART, RLENGTH)}' file
This gives the desired result.
123 567.
However there must be other better way to select both numbers without
writing two match statements.
Thanks.

Media queries for each browser

Media queries for each browser

I want to resize my input field as per browser. can I write media query
for each browser so separate width for input field on separate browser,
like for mozilla it will have separate width on chrome and opera it will
have separate width.

Tuesday, 27 August 2013

How can I assign the json response from query.ajax to a variable?

How can I assign the json response from query.ajax to a variable?

I am try to get the json response from a url. Below is the php code which
I am requesting to:
if($_POST){
header('Content-type: application/json');
echo '{"hello":"world"}';
}
Below is the javascript I wrote:
$('#site').change(function(){
var result;
$.ajax({
url: "URL",
data: { param:value },
type: "POST",
dataType: "json",
success: function(data,textStatus,jqXHR) {
alert(data['hello']); //output: world
result = data;
},
});
alert(result['hello']); //output: nothing (didn't alert)
alert(result); //output: undefined
});
So, my question is how can I assign the data to the result? Thanks.

Creating new TextView isn't working

Creating new TextView isn't working

I have a Spinner, EditText and a Button. When I enter something in
EditText and then click on a Button, I want it to create a new TextView
according to which item on spinner is selected.
Button click method:
public void submitScore(View v){
final int position = playerList.getSelectedItemPosition();
EditText input = (EditText) findViewById(R.id.editText1);
createNewTextView (players.get(position) + input);
}
createNewTextView():
private TextView createNewTextView (String text){
final LayoutParams lparams = new
LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
final TextView newTextView = new TextView(this);
newTextView.setLayoutParams(lparams);
newTextView.setText(text);
return newTextView;
}
Whole XML code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".Igra" >
<Spinner
android:id="@+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/editText1"
android:orientation="vertical" >
</LinearLayout>
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/spinner1"
android:layout_toLeftOf="@+id/button1"
android:layout_toRightOf="@+id/textView1"
android:ems="10" >
<requestFocus />
</EditText>
<Button
android:id="@+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/editText1"
android:layout_alignParentRight="true"
android:text="Enter"
android:onClick="submitScore" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/editText1"
android:layout_alignBottom="@+id/editText1"
android:layout_alignParentLeft="true"
android:text="Score:" />
As you can see; I have both Relative and Linear Layout inside this
activity and they are separated (LinearLayout is under the
RelativeLayout).
I want this TextView to be added into LinearLayout but it isn't added
anywhere, I can't see it when I press a button.
My code now:
public void submitScore(View v){
LinearLayout lLayout = (LinearLayout) findViewById (R.id.linearLayout);
final int position = playerList.getSelectedItemPosition();
EditText input = (EditText) findViewById(R.id.editText1);
final LayoutParams lparams = new
LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
final TextView newTextView = new TextView(this);
newTextView.setLayoutParams(lparams);
newTextView.setText(players.get(position) + input);
//createNewTextView (players.get(position) + input);
lLayout.addView(newTextView);
}

customizing my mvc app with server side parameters

customizing my mvc app with server side parameters

I have an mvc app that works mostly client side with knockoutjs. I have
the need of configuring it for different type of installations so I will
have custom parameters for some colors for example. Now I put everything
in a js file on the client, but because this is something that does not
change while the app is running I was thinking to put this on the server
side and modify my view depending on those custom params so the page will
just be rendered server side with the right colors.
What is the best way of doing this with MVC? all the answers I found use:
ConfigurationManager.GetSection to read from the web.config file but it's
not very clear if it works in mvc and if after that I need to put the
values in a model and attach it to the view.
something like this is suggested all the time: var somevar = "@item" but
what is item in an view?

Access other object instances

Access other object instances

I have this issue.If I create an object(x) instance from a another
object(a) I have access to it with the setters but if the object(x) is
created by itself or from another object(b) I don't have access to it from
my object(a) unless it is static.So how am I supposed to access it?

Monday, 26 August 2013

Create DLL file using C# to use in java

Create DLL file using C# to use in java

Hey guys I'm java developer however I need to work around c#. In my
company we are facing some issues in java so we decided to call dll
function through java. I wrote .cs file as follow
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Com
{
[ClassInterface(ClassInterfaceType.AutoDual),
Guid("F2F37A34-A440-4e82-A941-996056AADD88")]
public class Calculation
{
[DebuggerNonUserCode]
public Calculation()
{
}
public int sum(int x, int y)
{
return checked(x + y);
}
public int subtract(int x, int y)
{
return checked(x - y);
}
public int multi(int x, int y)
{
return checked(x * y);
}
public double Div(int x, int y)
{
if (y != 0)
{
return (double)x / (double)y;
}
return 0.0;
}
}
}
To create DLL File I'm using csc.exe /t:library /out:D:/test.dll
To Register DLL File I'm using RegAsm /verbose /nologo /codebase D:\test.dll
To Unregister DLL File I'm using RegAsm.exe /unregister D:\test.dll
I'm able to call this DLL in java program using jacob library. My problem
is when I'm trying to call same dll using Applet it throws exception.
So to call DLL over network/browser do I have to follow other things?
OR
Is there any other way to create DLL file or say parameter I've to set to
use it over network/browser...

Alternative index (with an alternative theme)

Alternative index (with an alternative theme)

I am new both to web-development/php and to wordpress. I've done a custom
wordpress theme and it's ok. I'm using MAMP as local apache/mysql server.
It works with permalinks "post name" setting and I like it very much, but
it is hiding me the real page names.
Now, I'd like to have an alternative index, a page like:
localhost:8888/mywordpress/index2.php
or
localhost:8888/mywordpress/index.php?somearguments
(I don't know which one is the easiest solution)
where I have the same as localhost:8888/mywordpress/ (I guess it's
localhost:8888/mywordpress/index.php) but with some html element more
(like two or three div more, and some js script more). Let's say that it
could easily be an alternative theme.
So, for recap, 2 alternative index:
localhost:8888/mywordpress/ with my custom theme
localhost:8888/mywordpress/index2.php with my custom theme PLUS some more
element
I've tried to read the code of index.php and template-loader.php but the
only clear thing is that I don't have to touch those files (or other
wordpress configuration files).
I tried to google a little bit and I've found some black magic (that I
really don't know anything about) with .htaccess that I am scared about.
I'm looking for the more easy solution (also a dirty one) that doesn't
make me touch some strange configuration that I can't handle.
What is my best bet?

Order rows with specific parameters

Order rows with specific parameters

I have this table filled as follows http://sqlfiddle.com/#!2/3736a/4, what
I'm trying to do is the next:
I have n groups of names (in this case 4 group names: CAFE NESCAFE, CAFE
LEGAL, CAFE INTERNA, null) from the column nom_agrupacion, and I need to
sort them first by nom_agrupacion (name of group) and then by other column
which is costo.
The query to do that is this
SELECT * FROM bby_venta_co WHERE promocion_id = 100000189
AND ti = 153
AND ffi = 12
AND ci = 1
ORDER BY nom_agrupacion DESC, costo DESC;
and get this
ID DTTI TI FFI CI PROMOCION_ID CODIGO_BARRAS COSTO
NOM_AGRUPACION
53 1101 153 12 1 100000189 7501001602727 34.55 CAFE
NESCAFE
55 1102 153 12 1 100000189 7501001602727 34.55 CAFE
NESCAFE
62 1107 153 12 1 100000189 7501059224841 19.45 CAFE
NESCAFE
65 1108 153 12 1 100000189 17501052411115 28.3 CAFE
LEGAL
66 1109 153 12 1 100000189 17501052411115 28.3 CAFE
LEGAL
67 1110 153 12 1 100000189 7501052411118 24.8 CAFE
LEGAL
57 1103 153 12 1 100000189 7501052411118 24.8 CAFE
LEGAL
61 1106 153 12 1 100000189 17501052418732 55.6 CAFE
INTERNA
52 1100 153 12 1 100000189 27501052418739 32.6 CAFE
INTERNA
51 1099 153 12 1 100000189 27501052418739 32.6 CAFE
INTERNA
60 1105 153 12 1 100000189 7501052418520 19.35 CAFE
INTERNA
59 1104 153 12 1 100000189 7501000112388 12.9 (null)
68 1111 153 12 1 100000189 7501000112388 12.9 (null)
But I need to sort the information so I can get this: Bring the first row
of every group name(I got 4 becasue null counts as group also) then bring
the second row of every group and so on to get something like this
ID DTTI TI FFI CI PROMOCION_ID CODIGO_BARRAS COSTO
NOM_AGRUPACION
53 1101 153 12 1 100000189 7501001602727 34.55 CAFE
NESCAFE
66 1109 153 12 1 100000189 17501052411115 28.3 CAFE
LEGAL
61 1106 153 12 1 100000189 17501052418732 55.6 CAFE
INTERNA
59 1104 153 12 1 100000189 7501000112388 12.9 (null)
55 1102 153 12 1 100000189 7501001602727 34.55 CAFE
NESCAFE
65 1108 153 12 1 100000189 17501052411115 28.3 CAFE
LEGAL
52 1100 153 12 1 100000189 27501052418739 32.6 CAFE
INTERNA
68 1111 153 12 1 100000189 7501000112388 12.9 (null)
62 1107 153 12 1 100000189 7501059224841 19.45 CAFE
NESCAFE
57 1103 153 12 1 100000189 7501052411118 24.8 CAFE
LEGAL
51 1099 153 12 1 100000189 27501052418739 32.6 CAFE
INTERNA
60 1105 153 12 1 100000189 7501052418520 19.35 CAFE
INTERNA
Is this even possible in one query?
I have tried to at least bring the first row of every group once but my
query isn't working properly:
SELECT * FROM bby_venta_co WHERE promocion_id = 100000189
AND ti = 153
AND ffi = 12
AND ci = 1
GROUP BY costo, nom_agrupacion
ORDER BY nom_agrupacion DESC, costo DESC;
I use group by to first bring the single cost and then bring the single
nom_agrupacion but it seems it only reads cost, and if I only use group by
nom_agrupacion it doesn't bring me the rows of column costo with the
highest values.
Any help will be appreciate.

See if bootstrap checkbox is checked asp.net c#

See if bootstrap checkbox is checked asp.net c#

I need to get true or false if bootstrap check-box is checked on server side
This is the control:
<div id="CheckCategoria" runat="server" class="btn-group"
data-toggle="buttons-checkbox" runat="server">
<asp:Button ID="ChkInspecao" OnClientClick="return
false;" Text="Inspeção" UseSubmitBehavior="False"
runat="server" CssClass="btn btn-check" />
<asp:Button ID="ChkHipot" OnClientClick="return
false;" Text="Hipot" UseSubmitBehavior="False"
runat="server" CssClass="btn btn-check" />
<asp:Button ID="ChkCalibracao"
OnClientClick="return false;" Text="Calibração"
UseSubmitBehavior="False" runat="server"
CssClass="btn btn-check" />
<asp:Button ID="ChkChecagemInterna"
OnClientClick="return false;" Text="Checagem
Interna" UseSubmitBehavior="False"
runat="server" CssClass="btn btn-check" />
<asp:Button ID="ChkRevisao"
OnClientClick="return false;" Text="Revisão"
UseSubmitBehavior="False" runat="server"
CssClass="btn btn-check" />
</div>
as they have runnat="sever", I can get them on server-side but how can I
see if it's toggled or not?
I tried:
string Inspecao = ChkInspecao.Attributes["checked"];
but it's returning null.
how can I do that?

Objective C assigning a value to a variable

Objective C assigning a value to a variable

I have this line in my header file
@property (strong, nonatomic) NSMutableDictionary *weatherData;
And I'm truing to do the following on my implementation
-(void)doSomething {
NSMutableDictionary *data = [[NSMutableDictionary alloc] init];
//after adding items to data
self.weatherData = data;
}
then I have a function to get
-(NSMutableDictionary *)getWeaterData {
NSLog([self.weatherData description]);
return self.weatherData;
}
Why does noting gets printed, above data has data in it.

select last 5 rows in join query sql-server 2008

select last 5 rows in join query sql-server 2008

I am trying to bring the last 5 rows of the Order table based on OrderDate
with the column name "firstname" from Customer table. The below query
displays all the values from Order table instead of last 5 rows.
SELECT
A.[FirstName],B.[OrderId],B.[OrderDate],B.[TotalAmount],B.[OrderStatusId]
FROM [schema].[Order] B
OUTER APPLY
( SELECT TOP 5 *
FROM [schema].[Customer] A
WHERE B.[CustomerId]=1 AND A.[CustomerId]=B.[CustomerId]
ORDER BY
B.[OrderDate] DESC
) A
Any mistake in my logic of using TOP and DESC ?

Two keyboard two language layouts

Two keyboard two language layouts

I want to connect to keyboard sets to my computer. Is it possible to set
each for a specific language. So that there's no need to change language
each time.
eg:
keyboard 1 types russian
keyboard 2 types english

Sunday, 25 August 2013

Capturing counter value in Javascrript closure

Capturing counter value in Javascrript closure

The following code creates 10 elements under <body id="container" />. When
i click on any element, I always see an alert with the value 10.
How can I get each alert to show the index of each element?
for (var i = 0; i < 10; ++i) {
var id = "#element_" + i;
$("#container").append('<p id="element_' + i + '">foo</p>');
$(id).click(function (e) {
alert(i);
});
}

.Jar will not run on Blogger

.Jar will not run on Blogger

I have made my file and cannot get it to run on blogger. I have looked at
alot of information about this and cannot seem to get it to run. Is there
a problem with my code? It always comes up with class not found problem.
<applet code = "Snake" height=300 width=300
codebase="https://sites.google.com/site/zmchenryfilecabinet/filecabinet/">
</applet>
This is the output of the jar tf Snake.jar command in the ocmmand prompt:
META-INF/MANIFEST.MF
.classpath
Snake.class
Apple.class
applescaled.png
bodySprite.png
headSprite.png
apple.png
Snake.java
controlScreen.jpg
snakehead.png
endAnimation.gif
apple1.png
snakebody.png
.project
In the manifest there is an empty line after my class file and in the
manifest it reads:
Manifest-Version: 1.0
Main-Class: Snake
Also my main class begins with public class Snake extends JApplet{
Thank you for your help.

Install TOR Browser on CentOS 6.4?

Install TOR Browser on CentOS 6.4?

I've been trying to install the TOR bundle on my fresh install of CentOS
but I've found that most repo's are outdated and/or not working. Anyone
know a simple way of installing it for CentOS 6.4??
Thanks in advance.

Construct a function at runtime in C#

Construct a function at runtime in C#

Lambda expressions are evaluated at compile time, so the below code will
not generate a 100 different functions. Is there a simple mechanism to
achieve the mentioned effect? I realize this isn't very efficient
performance wise.
List<Action> actions = new List<Action>();
for (int i = 0; i < 100; ++i)
actions.Add(() => Execute(100100100 + i));

my single.php is mixup on some post for no reason

my single.php is mixup on some post for no reason

some of my post is shown well(like http://exam.downloadkaran.com/?p=453)
but another post is not shown well(like
http://exam.downloadkaran.com/?p=258)!!! i don't know exactly what should
i have to search for. would u please to help me to find a clue. where to
start to find my bug. i compare two file but find no mistake all div and
other tag are closed well. in some post the problem is solved when i
remove
<?php the_tags(__(' ','dnld'), __(', ','dnld'), __('','dnld')); ?>
but in another one no. it is so complex situation!!! my single.php is here:
<?php include (TEMPLATEPATH . "/sevenmid.php"); ?>
<div class="midpostbody post">
<div class="postheader">
<a href="<?php the_permalink();?>"><?php
the_title();?></a>
</div><!--End post header-->
<div class="view"><span><?php
if(function_exists('the_views')) { the_views(); }
?></span></div>
<div class="category"><span><?php the_category(',');
?></span><a href="#">äÑã ÇÝÒÇÑ</a></div>
<div class="clear"></div>
<div class="postimg"> <?php if(has_post_thumbnail()){
the_post_thumbnail();} else {?>
<img src="<?php bloginfo('template_directory');
?>/images/Koala.jpg" alt="<?php the_title();?>" />
<?php }?>
</div>
<div class="customsize">
<?php if(get_post_custom_values('sizelabel')) : ?>
<span><?php echo get_post_meta($post->ID,
'sizelabel',true); ?>&nbsp;|</span>
<?php endif; ?>
<?php if(get_post_custom_values('size')) : ?>
<span> <?php echo get_post_meta($post->ID,
'size',true); ?></span>
<?php endif; ?>
</div>
<div id="sincontent">
<?php the_content(); ?>
</div>
<div id="postdata">
<div id="sharepic"><img src="<?php
bloginfo('template_directory'); ?>/images/sharep.png"
alt="share here." /></div>
<div id="postsocial">
<ul>
<li><a href="#"><img src="<?php
bloginfo('template_directory');
?>/images/cloob.png" alt="cloob" /></a></li>
<li><a href="#"><img src="<?php
bloginfo('template_directory');
?>/images/twitter.png" alt="cloob" /></a></li>
<li><a
href="#"><img src="<?php
bloginfo('template_directory');
?>/images/facebook.png" alt="cloob"
/></a></li> <li><a
href="#"><img src="<?php
bloginfo('template_directory');
?>/images/google.png" alt="cloob" /></a></li>
<li><a
href="#"><img src="<?php
bloginfo('template_directory');
?>/images/technorati.png" alt="cloob"
/></a></li>
<li><a href="#"><img src="<?php
bloginfo('template_directory');
?>/images/delicious.png" alt="cloob"
/></a></li>
<li><a href="#"><img
src="<?php bloginfo('template_directory');
?>/images/friendfeed.png" alt="cloob"
/></a></li>
</ul>
</div><!--End postsocial-->
<div id="tabs">
<ul>
<li> <a href="#tabs-3">á&#1740;ä˜ åÇ&#1740;
ÏÇäáæÏ</a></li>
<li> <a href="#tabs-1">ÑÇåäãÇ&#1740;
ÏÇäáæÏ</a></li>
<li> <a href="#tabs-2">ÑÇåäãÇ&#1740;
äÕÈ</a></li>
<li> <a href="#tabs-4">ãÔÎÕÇÊ</a></li>
<li> <a href="#tabs-5">Ó&#1740;ÓÊã ãæÑÏ
ä&#1740;ÇÒ</a></li>
</ul>
<div id="tabs-1">
<p>
<?php if(get_post_custom_values('direct')) : ?>
<span> <?php echo get_post_meta($post->ID,
'size',true); ?>&nbsp;|&nbsp;</span>
<span> <?php echo get_post_meta($post->ID,
'direct',true); ?></span>
<?php endif; ?>
<?php if(get_post_custom_values('link')) : ?>
<span> <?php echo get_post_meta($post->ID,
'linksize',true); ?>&nbsp;|&nbsp;</span>
<span> <?php echo get_post_meta($post->ID,
'link',true); ?></span>
<?php endif; ?>
yes this is
<br />
<br />
and don't be affriad of them.!!!
</p>
</div>
<div id="tabs-2" style="display:none;"><p>
<?php if(get_post_custom_values('downguid')) : ?>
<p> <?php echo get_post_meta($post->ID,
'downguid',true); ?></p>
<?php endif; ?>yes
</p></div>
<div id="tabs-3" style="display:none;"><p >
<?php
if(get_post_custom_values('installguid')) : ?>
<span> <?php echo get_post_meta($post->ID,
'installguid',true); ?></span>
<?php endif; ?>
</p></div>
<div id="tabs-4" style="display:none;"><p >
<?php if(get_post_custom_values('properties'))
: ?>
<span> <?php echo get_post_meta($post->ID,
'properties',true); ?></span>
<?php endif; ?>
</p></div>
<div id="tabs-5" style="display:none;">
<?php if(get_post_custom_values('requiresys'))
: ?>
<span> <?php echo get_post_meta($post->ID,
'requiresys',true); ?></span>
<?php endif; ?>
</div>
</div><!--End tab-->
<div id="errorpost">
<p>ÑãÒ ˜á&#1740;å ÝÇ&#1740;á åÇ
<strong>wwww.downloadkaran.com</strong>ã&#1740;
ÈÇÔÏ.</p>
<div><a>ÒÇÑÔ ÎÑÇÈ&#1740; á&#1740;ä˜</a></div>
</div><!--End error post-->
</div><!--End postdata-->
<div class="downsize"></div>
<div class="clear"></div>
<div class="label">
<div>
<strong>ÈэÓÈ åÇ:</strong>
<!--õÔÑæÚ-->
<?php the_tags(__(' ','dnld'), __(', ','dnld'),
__('','dnld')); ?>
<!--õÇ&#1740;Çä-->
</div>
</div><!--end label-->
<div class="clear"> </div>
<div class="date"><span><?php the_time(__('j / F /
Y','kubrick')) ?></span></div>
<div class="comment"><?php
comments_popup_link(__('&#1576;&#1583;&#1608;&#1606;
&#1606;&#1592;&#1585;'), __('1 &#1606;&#1592;&#1585;'),
__('% &#1606;&#1592;&#1585;')); ?></div>
<div class="clear"></div>
</div><!--End midpostbody post -->
<!--Real Post section-->
<?php
//for use in the loop, list 5 post titles related to first tag on current
post
$tags = wp_get_post_tags($post->ID);
if ($tags) {
$first_tag = $tags[0]->term_id;
$args=array(
'tag__in' => array($first_tag),
'post__not_in' => array($post->ID),
'posts_per_page'=>5,
'caller_get_posts'=>1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {?>
<div class="midpostbody post">
<div class="postheader">
<a >ÓÊ åÇ&#1740; ãÔÇÈå</a>
</div><!--End post header-->
<div id="related">
<ul><?php
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent
Link to <?php the_title_attribute(); ?>"><h2><?php the_title();
?></h2></a></li>
<br />
<?php
endwhile;
}?>
</ul>
</div><!--End related section-->
</div>
<?php wp_reset_query();
}
?>
<div id="shop" class="midpostbody">
<div id="gallery-wrap">
<ul id="gallery">
<?php $tmp_query = new
WP_Query('cat='.get_cat_ID('ÝÑæÔÇå'));
while ( $tmp_query->have_posts() ) :
$tmp_query->the_post();?>
<li>
<?php the_post_thumbnail();?>
<br />
<h2>
<a href="<?php the_permalink();?>"><?php
the_title(); ?></a>
</h2>
<div><a href="#">ÎÑ&#1740;Ï ÓÊ&#1740;</a></div>
</li>
<?php endwhile; wp_reset_query(); ?>
</ul><!--End gallary ul-->
</div><!--End gallery-wrap-->
<div id="gallery-controls">
<a href="#" id="gallery-next"></a>
<a href="#" id="gallery-prev"></a>
</div><!--End gallery controls-->
</div><!--End shop-->
<div id="signin" class="midpostbody">
<img src="<?php bloginfo('template_directory');
?>/images/group-poste-sabet.jpg" alt="ÚÖæ&#1740;Ê ÏÑ
ÂÑãÇä" />
<h3>
ãÒ&#1740;Ê åÇ&#1740; ÚÖæ&#1740;Ê ÏÑ ÂÑãÇä ÏÇäáæÏ :
</h3>
<ul>
<li> » ÏÑ&#1740;ÇÝÊ ÂÎÑ&#1740;ä ãØÇáÈ ÌÐÇÈ ãäÊÔÑ ÔÏå
ÏÑ ÓÇ&#1740;Ê</li>
<li> » ãÔÇåÏå ÂÎÑ&#1740;ä ãØÇáÈ ÎæÇäÏä&#1740; æ ÌÐÇÈ
ãäÊÔÑ ÔÏå ÏÑ ÇäÌãä</li>
<li>» ÏÑ&#1740;ÇÝÊ ÂÎÑ&#1740;ä Ú˜Ó åÇ&#1740; ÇÖÇÝå ÔÏå
Èå ÇáÑ&#1740; Ú˜Ó Ó Òã&#1740;äå</li>
<li> » ÇÑÓÇá ãØÇáÈ ÊÇË&#1740;Ñ ÐÇÑ æ ãÊÝÇæÊ ÇÒ ÓÑÇÓÑ
Ïä&#1740;Ç&#1740; æÈ ÝÇÑÓ&#1740; æ
Çäá&#1740;Ó&#1740;</li>
<li>» åÑ åÝÊå ãäÊÙÑ ØÇáÚ ÎæÏÊÇä ÈÇÔ&#1740;Ï æ Âä ÑÇ ÏÑ
Ç&#1740;ã&#1740;á ÊÇä ãÔÇåÏå ˜ä&#1740;Ï</li>
<li> » ÇØáÇÚ ÇÒ ÌÐÇÈ ÊÑ&#1740;ä ãØÇáÈ ÔȘå åÇ&#1740;
ÇÌÊãÇÚ&#1740; æ ÓÇ&#1740;Ê åÇ&#1740; ÎÈÑ&#1740;</li>
<li>» ÏÑ&#1740;ÇÝÊ ÂÎÑ&#1740;ä ãØÇáÈ æ Ú˜Ó åÇ&#1740;
ãÏ æ ÝÔä Ç&#1740;ÑÇä&#1740; æ ÎÇÑÌ&#1740;</li>
<li>» ÌÏ&#1740;ÏÊÑ&#1740;ä Ý&#1740;áã åÇ æ Ú˜Ó
åÇ&#1740; ãäÊÔÑ ÔÏå ÏÑ Ïä&#1740;Ç&#1740;
Ç&#1740;äÊÑäÊ</li>
<li> » ÂÎÑ&#1740;ä ÎÈÑåÇ&#1740; åäÑ&#1740; æ
ÇÞÊÕÇÏ&#1740; æ ʘäæáæŽ&#1740;….</li>
<li>» æ ÏÑ ÇäÊåÇ &#1740;ÔäåÇÏ åÇ&#1740; æ&#1740;Žå ãÇ
˜å ÝÞØ ãÎÕæÕ ÇÚÖÇ ã&#1740; ÈÇÔÏ </li>
</ul>
<div><a href="#"></a></div>
</div><!--òEnd signin Section-->
<div>
<?php?>
</div>
<?php include (TEMPLATEPATH . "/comments.php"); ?>
</div><!--End midpannel-->
<?php include (TEMPLATEPATH . "/sidebar-left.php"); ?>
<div class="clear"></div>
<div id="bottom" ></div><!--End bottom section-->
</div><!--End content section-->
</div><!--End outer section-->
<?php
wp_footer();
include(TEMPLATEPATH . "/footer.php");
?>

Qt C++ - Connect multiple objects to one signal

Qt C++ - Connect multiple objects to one signal

I am trying to connect two QSpinBox into the range (max/min value) of a
QSlider
connect(ui->lowerFrameBox, SIGNAL(valueChanged(int)), ui->timeSlider,
SLOT(setRange(int,int)));
Is what I'm using at the moment, but of course it will not work because
that only returns a single int. I need to either connect both into this,
which I doubt you can, or set the later int to it's current value, which
in this context is confusing me. Any help appreciated, new to QT.

Saturday, 24 August 2013

load data infile partially cuts phone numbers?

load data infile partially cuts phone numbers?

I made a table which name is 'test' in mysql in my PC like belows.
create table test( telnum varchar(20) not null, reg_date datetime not null
default '0000-00-00 00:00:00', remarks text, primary key(telnum) );
And I uploaded a file named 1.txt into table 'test'. 1.txt's contents are
like belows :
01011112222
01022223333
01033334444
And 'load data infile' syntax are like belows :
load data infile "c:/temp/1.txt" ignore into table test;
But there is a problem.
Every phone numbers were cut like below.
Query OK, 3 rows affected, 3 warnings (0.00 sec) Records: 3 Deleted: 0
Skipped: 0 Warnings: 3
mysql> select * from test;
+-------------+---------------------+---------+ | telnum | reg_date |
remarks | +-------------+---------------------+---------+
|12222 | 0000-00-00 00:00:00 |
|23333 | 0000-00-00 00:00:00 |
|34444 | 0000-00-00 00:00:00 |
+-------------+---------------------+---------+ 3 rows in set (0.00 sec)
Only 5 characters are remained from 11 characters. 6 characters disappeared.
And second problem is 'warnings'.
Reason of warnings is like below.
mysql> show warnings;
+---------+------+---------------------------------------------------+ |
Level | Code | Message |
+---------+------+---------------------------------------------------+ |
Warning | 1264 | Out of range value for column 'reg_date' at row 1 | |
Warning | 1264 | Out of range value for column 'reg_date' at row 2 | |
Warning | 1264 | Out of range value for column 'reg_date' at row 3 |
+---------+------+---------------------------------------------------+
3 rows in set (0.00 sec)
I did'nt put anything into the reg_date field. But the message says out of
range value for column 'reg_date'.
What are the reasons and how can I solve these problems?

Website URL Link technique

Website URL Link technique

http://www.stamford.edu/Admissions/Degree/BachelorDegree
How can I develop my url website like the above link?

JAVA moving a jlabel in a circualar Path GUI

JAVA moving a jlabel in a circualar Path GUI

I am.working. on a netbeans java project in jframeform (a GUI application)
where I want to move a jlabel into circular. path. so can any tell or help
to how to do that??
DcodeX

ruby gem for music details.

ruby gem for music details.

Can someone please suggest me some gem that can give top 10 songs of
particular Artist.
I am using Itunes gem, but it gives me list of all songs of artist. I want
only top 10 songs.

photo on gmail there must be 15 characters [on hold]

photo on gmail there must be 15 characters [on hold]

why do you people make it so difficult to get rid of picture on gmail
page? It's a real pain in the neck. all your bleeping secret links and
stuff, why not just say "delete" picture without putting in another on.
fix this for me or I delete gmail and move to yahoo or some other obscure
service. You are really getting on my nerves

Flex: Bindable object passed to component null reference

Flex: Bindable object passed to component null reference

I am trying to pass an object (a class that has a constructor that
initializes the values) from the main application to a custom component.
However, in the custom component I get a null reference exception even
though I use it on creation complete event.
This only happens when I try to use it in a function of the custom
component and it works if I set the property in the mxml tag.
//LeftAligned.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="0" height="0"
creationComplete="creationCompleteHandler(event)">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects)
here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import classes.CardDetails;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.events.FlexMouseEvent;
[Bindable]
public var cardDetails:CardDetails;
protected function creationCompleteHandler(event:FlexEvent):void
{
drawFields();
}
protected function drawFields():void {
//null reference
Alert.show("Length: " + cardDetails.detailList.length);
}
]]>
</fx:Script>
<s:TextInput id="title" width="250"
x="91" y="143"
styleName="cardTextInput"
text="{cardDetails.title}"/>
</s:SkinnableContainer>
The object is passed to the custom component in App.mxml
//App.mxml
<standard:LeftAligned cardDetails="{cardDetails}"/>
What am I missing and what can I do to be able to access the object in the
custom component?

Friday, 23 August 2013

Is there a mod/tool for minecraft (with Forge) to export all item ID's, Metadata and Names

Is there a mod/tool for minecraft (with Forge) to export all item ID's,
Metadata and Names

I am attempting to export a list of all item ids, and metadata from
minecraft. I am using the FTB Unleashed pack. What I want is to write to
file:
351:1 Ink Sac
351:2 Rose Red
...
368:0 Ender Pearl
369:0 Blaze Rod
...
2174:0 Naga Stone
Or something that I can convert to that with some regex etc.
I need something, a mod, a tool, a server command, that will export this
data to a file. It should be compatible with minecraft 1.5.2, with mods
installed (Including Forge mods).
NEI, and Item Resolver both only export item IDs. However this is not
useful to me because some mod, heavily use the metadata value, to store a
different item in the same ID space. The Vanilla Dye is an example of
this.
I am coming the the conclusion I may just have to make it myself.
EDIT: I would like this for computercraft fun. I many computercraft things
return only the item id / metadata eg the ME Bridge and Interactive
Sorter. Other computer craft mods (AE Peripheral, OpenCCsensors) do handle
item names. However I am unwilling to add mods to the server. If a there
is a mod I can use in single player to export all the ID, metadata and
names, then I can use a computercraft program to parse it, that can run on
the server. (I already have one working for ID/Name)
I would also like this for my own interest, I'ld like to see just how much
metadata is used in some mods, to represent different items, (I'm looking
at you, Forestry).

What I'm missing in my Entities in order to get content values from product_has_product_detail and label from product detail having...

What I'm missing in my Entities in order to get content values from
product_has_product_detail and label from product detail having...

I have this DB model:

I need to get the value of product_has_product_detail.content and
product_detail.label just having product.id. This are my entities:
namespace ProductBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity
* @ORM\Table(name="product")
*/
class Product {
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=255)
*/
protected $name;
/**
* @ORM\Column(type="text")
*/
protected $description;
/**
* @ORM\Column(type="smallint")
*/
protected $age_limit;
/**
* @Gedmo\Timestampable(on="create")
* @ORM\Column(name="created", type="datetime")
*/
protected $created;
/**
* @Gedmo\Timestampable(on="update")
* @ORM\Column(name="modified", type="datetime")
*/
protected $modified;
/**
* @ORM\ManyToMany(targetEntity="CategoryBundle\Entity\Category",
inversedBy="products")
* @ORM\JoinTable(name="product_has_category")
*/
protected $categories;
/**
* @ORM\ManyToMany(targetEntity="ProductBundle\Entity\ProductDetail",
inversedBy="products_details")
* @ORM\JoinTable(name="product_has_product_detail")
*/
protected $details;
/**
* @ORM\OneToMany(targetEntity="StockBundle\Entity\KStock",
mappedBy="product")
*/
protected $stocks;
/**
* @ORM\OneToMany(targetEntity="ProductBundle\Entity\ProductHasMedia",
mappedBy="product")
*/
protected $medias;
/**
* @ORM\ManyToOne(targetEntity="ProductBundle\Entity\NBrand")
* @ORM\JoinColumn(name="brand", referencedColumnName="id")
* */
private $brand;
public function __construct() {
$this->categories = new
\Doctrine\Common\Collections\ArrayCollection();
$this->details = new \Doctrine\Common\Collections\ArrayCollection();
$this->stocks = new \Doctrine\Common\Collections\ArrayCollection();
$this->medias = new \Doctrine\Common\Collections\ArrayCollection();
}
public function getId() {
return $this->id;
}
public function setName($name) {
$this->name = $name;
}
public function getName() {
return $this->name;
}
public function setDescription($description) {
$this->description = $description;
}
public function getCondition() {
return $this->condition;
}
public function setAgeLimit($age_limit) {
$this->age_limit = $age_limit;
}
public function getAgeLimit() {
return $this->age_limit;
}
public function setMedias(\MediaBundle\Entity\Media $medias) {
$this->medias[] = $medias;
}
public function getMedias() {
return $this->medias;
}
public function setCreated($created) {
$this->created = $created;
}
public function getCreated() {
return $this->created;
}
public function setModified($modified) {
$this->modified = $modified;
}
public function getModified() {
return $this->modified;
}
public function setBrand($brand) {
$this->brand = $brand;
}
public function getBrand() {
return $this->brand;
}
public function __toString() {
return $this->name;
}
public function getDetails() {
return $this->details;
}
}
namespace ProductBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="product_has_product_detail")
*/
class ProductHasProductDetail {
/**
* @ORM\Id
* @ORM\ManyToOne(targetEntity="ProductBundle\Entity\Product")
* @ORM\JoinColumn(name="product", referencedColumnName="id")
*/
protected $product;
/**
* @ORM\Id
* @ORM\ManyToOne(targetEntity="ProductBundle\Entity\ProductDetail")
* @ORM\JoinColumn(name="detail", referencedColumnName="id")
*/
protected $detail;
/**
* @ORM\Column(type="string", length=255)
*/
protected $content;
public function setProduct(\ProductBundle\Entity\Product $product) {
$this->product = $product;
}
public function getProduct() {
return $this->product;
}
public function setDetail(\ProductBundle\Entity\ProductDetail $detail) {
$this->detail = $detail;
}
public function getDetail() {
return $this->detail;
}
public function setContent($content) {
$this->content = $content;
}
public function getContent() {
return $this->content;
}
}
What I miss?
UPDATE
I've added this to Product entity:
/**
*
@ORM\OneToMany(targetEntity="ProductBundle\Entity\ProductHasProductDetail",
mappedBy="detail")
*/
protected $details;
And this is what I've in my Twig template:
{{ entity.getName }}
{% for item in entity.getDetails %}
a {{ item.getDetail.getContent }}
{% endfor %}
As result it never display getDetails (of course data exists at DB)

How to store Data from static WebMethods into the ViewState

How to store Data from static WebMethods into the ViewState

Now I have done some research. I need to store some data that I have
retrieved from an ajax call to my WebMethod on my page into some place
where I can pull it back again anytime.
I thought at first that the ViewState would be the best option.
Unfortunately you cannot reference it in the same way you can in
non-static methods. Even if I make instance of the page to store it in the
ViewState, I believe that it would be de-instantiated at the end of the
method destroying whatever data I saved.
I need this data for the purpose of database calls that I am doing in
other WebMethods.
The basic method in my C# codebehind for my aspx page looks like this:
[WebMethod]
[ScriptMethod]
public static string populateModels(string[] makeIds)
{
}
So for example I need to save the selected makes to pull from for future
database calls. Since most of my boxes cascade in terms of filtering and
pulling from the database.

what is the meaning of "===" in java script?

what is the meaning of "===" in java script?

I have seen many using "===" in conditional statements.
Can anyone tell me what does it means?
something like triteary operator?
if(typeof(x) == "string")
{
x= (x=== "true");
}

Cannot find file on netbeans

Cannot find file on netbeans

I'm trying to access a data file to get questions and answers for my
"Quiz" application. If I access the file from the one on my desktop, it
works fine. If I drag and drop the file into my netbeans, I cannot seem to
access it. The file is in the package "quiz" along with my other classes.
Here's the code that works but I want to use the netbeans file.
String fileName = "C:/Users/Michael/Desktop/QUIZ.DAT";
try {
//Make fileReader object to read the file
FileReader file = new FileReader(new File(fileName));
BufferedReader fileStream = new BufferedReader(file);
} catch (Exception e) {
System.out.println("File not found");
}
To try and access the file on netbeans I use this but it cannot find it.
String fileName = "quiz/Quiz.DAT";

Thursday, 22 August 2013

Thread Management in OSX Command Line C Application

Thread Management in OSX Command Line C Application

I am learning Mac App development, starting with command line applications
and the Core Foundation API. What I am wanting to do is listen for file
system events while the application is running in the terminal. When the
user quits, it cleanly shuts down the stream and exits. Here is what I
have...
#include <CoreServices/CoreServices.h>
#include <stdio.h>
void eventCallback(FSEventStreamRef stream, void *callbackInfo, size_t
numEvents, void *paths, FSEventStreamEventFlags flags[],
FSEventStreamEventId eventId[]) {
printf("Test");
}
int main(int argc, const char * argv[])
{
CFStringRef mypath = CFSTR("/Path/to/folder");
CFArrayRef paths = CFArrayCreate(NULL, (const void **)&mypath, 1, NULL);
CFRunLoopRef loop = CFRunLoopGetMain();
FSEventStreamRef stream = FSEventStreamCreate(NULL, eventCallback,
NULL, paths, kFSEventStreamEventIdSinceNow, 3.0,
kFSEventStreamCreateFlagNone);
FSEventStreamScheduleWithRunLoop(stream, loop, kCFRunLoopDefaultMode);
FSEventStreamStart(stream);
bool done;
# Somehow put main thread to sleep here...
# On exit of application
FSEventStreamStop(stream);
FSEventStreamInvalidate(stream);
FSEventStreamRelease(stream);
return 0;
}
So I've determined that using either the main threads run loop (or maybe a
separate thread) should do this work, but I am not sure the best way in
which to put the thread to sleep while waiting for events. I am not
familiar enough with Apple's API to know what to do.
Thanks for any help!

Give all units in region

Give all units in region

In the map editor, is there a trigger to give all units within a region to
another player? "Change Ownership" only applies to a single unit.

Remove individual rows of a grid view only on the client side

Remove individual rows of a grid view only on the client side

I have a drop down list. On changing the index of the dropdownlist , I
populate an asp.net gridview.
I have a requirement where the user should be able to remove individual
rows of the gridview on the screen . At the end of each row, I intend to
have a remove button. On clicking the button the row should disappear .
But this should be only on the screen. There should be no changes done in
the database.
I have my code below right now :
aspx
<table>
<tr>
<td>
<div>
<asp:Label ID="lblClient" runat="server" Text="Client
:" CssClass="label" ForeColor="Black"></asp:Label>
<asp:DropDownList ID="ddlClient" runat="server"
AppendDataBoundItems="true" AutoPostBack="true"
OnSelectedIndexChanged="ddlClient_SelectedIndexChanged">
<asp:ListItem Text="ALL" Value="0"></asp:ListItem>
</asp:DropDownList>
</div>
</td>
</tr>
<tr>
<td>
<asp:GridView ID="gvMainLog" runat="server" Visible="true"
AllowSorting="True" AutoGenerateColumns="False"AllowPaging="true">
<Columns>
<asp:BoundField DataField="Instruction"
HeaderText="Instruction" />
<asp:BoundField DataField="ProviderId" HeaderText="Id" />
</Columns>
</asp:GridView>
<div>
<asp:TextBox ID="txtEditMin"
runat="server"></asp:TextBox>
</div>
</td>
</tr>
</table>
aspx.cs
protected void ddl_SelectedIndexChanged(object sender, EventArgs e)
{
gvMainLog.DataSource = GetSetupUtility(1);
gvMainLog.DataBind();
}

Connecting signals to slots with less params allowed in Qt?

Connecting signals to slots with less params allowed in Qt?

Is it valid to call
QObject::connect(a, SIGNAL(somesig(someparam)), b, SLOT(someslot()));
without params? It seems to work (no runtime exception thrown) but I can't
find a reference in the docs. All I found is that this is possible if
someslot has a default parameter. It is valid in this case. But my method
someslot has not the same parameter set as default (no parameter here in
the example).
So it seems to be possible to wire signals to slots with less parameters?

Reverse Geocode - return locality

Reverse Geocode - return locality

I'm having trouble returning a city using reverse geocoding in Objective C
on iOS. I'm able to log the city within the completionHandler, but I can't
seem to figure out how to return it as a string if it's called from
another function.
The city variable is an NSString created in the header file.
- (NSString *)findCityOfLocation:(CLLocation *)location
{
geocoder = [[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:location completionHandler:^(NSArray
*placemarks, NSError *error) {
if ([placemarks count])
{
placemark = [placemarks objectAtIndex:0];
city = placemark.locality;
}
}];
return city;
}

drawing an SDL_Rect not working

drawing an SDL_Rect not working

I am trying to build an RTS in C++ using SDL. Now I'm trying to make a
rectangle which will select units(resizable selection box). It will be a
transarent yellow rectangle. When I run the program and try to selectg
multiplyunits. Nothing happens(I mean drawing the rect. Selecting is not
made yet)
This is the code(in main.cpp):
...
Uint32 selection_colour;
SDL_Rect box_rect;
int M1X = 0;
int M1Y = 0;
int M2X = 0;
int M2Y = 0;
int W;
int H;
...
void init()
{
...
selection_colour = SDL_MapRGBA(screen->format, 0xFF, 0xFF, 0, 0.3);
...
}
...
while(running)
{
while(SDL_PollEvent(&event))
{
if(event.type == SDL_MOUSEBUTTONDOWN)
{
if(event.button.button == SDL_BUTTON_LEFT)
{
M2X = event.motion.x;
M2Y = event.motion.y;
W = M2X - M1X;
H = M2Y - M1Y;
box_rect.x = M1X;
box_rect.y = M1Y;
box_rect.w = W;
box_rect.h = H;
}
}else
{
M1X = event.motion.x;
M1Y = event.motion.y;
}
}
SDL_FillRect(screen, &box_rect, selection_colour);
SDL_Flip(screen);
}
any suggestions??

Wednesday, 21 August 2013

Ruby: How do I access module local variables?

Ruby: How do I access module local variables?

I get this error: MyModule.rb:4:in getName': undefined local variable or
methods' for MyModule:Module (NameError)
file1
module MyModule
s = "some name"
def self.getName()
puts s
end
end
file2
require './MyModule.rb'
include MyModule
MyModule.getName()
This has something to do with scope, but I'm not comprehending why this is
happening if I declared it before the method. does include only mixin
methods and not variables? How do I change my module so that it can print
out variables I define within the module?

Best way to Design a blog schema mongodb

Best way to Design a blog schema mongodb

I am trying to find the best way to design a blog site data schema for
mongodb where the documents are:
user, discussion comment
is it best to use normalization i.e make discussion a sub document (array)
of user and make comment a sub document of (array) discussion or is it
better to denormalize by making each document a separate collection.
operations on discussion and comment include all CRUD operations

After screen turns off, monitor stops responding

After screen turns off, monitor stops responding

I have 2 monitors connected to my computer running Windows 7 SP 1. If I
leave my computer for a while, Windows starts the screen saver (which for
me is just a black screen). It is not in sleep mode; I have that disabled.
However, sometimes when I wake my computer back up, one of the monitors
stops responding. I cannot turn it off with the button on the front, nor
do any of the other buttons work; it just completely stops responding. The
power light is still on on the monitor though. The only way to get it to
work again is if I unplug it for a couple of seconds, and plug it back in.
It doesn't always happen to the same monitor, I have had it happen both
monitors. (Not at the same time, though) It only happens rarely though,
maybe once every 2 weeks or so. This is very inconvenient, and I was
wondering if anybody knew why this was happening and/or if there is a way
to fix it.

Java string index out of range: 0

Java string index out of range: 0

I have this problem where as soon as I enter my first input the program
crashes and I get
String index out of range: 0
I've looked elsewhere and tried to find my mistakes but I found different
problems which aren't what I had. Could someone please tell me where have
I gone wrong?.
Thanks for your help, here is the code:
import java.util.Scanner;
public class Assignment1Q2 {
public static void main(String[] args) {
System.out.println("Thank you for your call,\nPlease take some
time to answer a few questions");
collectData();
}//end of main
public static void collectData() {
Scanner userInput = new Scanner(System.in);
int age;
char gender;
char show;
int over30MY = 0, over30FY = 0, under30MY = 0, under30FY = 0;
int over30MN = 0, over30FN = 0, under30MN = 0, under30FN = 0;
System.out.println("\nWhat is your age?\n");
age = userInput.nextInt();
System.out.println("Male or Female (Enter M or Y)");
gender = userInput.nextLine().charAt(0);
gender = Character.toLowerCase(gender);
System.out.println("Do you watch the show regularly? (Enter Y or
N)");
show = userInput.nextLine().charAt(0);
show = Character.toLowerCase(show);
if((age > 30) && (gender == 'm') && (show == 'y')) {
over30MY++;
}
else if((age > 30) && (gender == 'f') && (show == 'y')) {
over30FY++;
}
else if((age < 30) && (gender == 'm') && (show == 'y')) {
under30MY++;
}
else if((age < 30) && (gender == 'f') && (show == 'y')) {
under30FY++;
}
else if((age > 30) && (gender == 'm') && (show == 'n')) {
over30MN++;
}
else if((age > 30) && (gender == 'f') && (show == 'n')) {
over30FN++;
}
else if((age < 30) && (gender == 'm') && (show == 'n')) {
under30MN++;
}
else if((age < 30) && (gender == 'f') && (show == 'n')) {
under30FN++;
}//end of if else
}//end of collectData
}// end of class

Filtering file list and removing unwanted extensions using Enumerable and Lambda

Filtering file list and removing unwanted extensions using Enumerable and
Lambda

I am using this code
private IEnumerable<String> FindAccessableFiles(string path, string
file_pattern, bool recurse)
{
IEnumerable<String> emptyList = new string[0];
if (File.Exists(path))
return new string[] { path };
if (!Directory.Exists(path))
return emptyList;
var top_directory = new DirectoryInfo(path);
// Enumerate the files just in the top directory.
var files = top_directory.EnumerateFiles(file_pattern);
var filesLength = files.Count();
var filesList = Enumerable
.Range(0, filesLength)
.Select(i =>
{
string filename = null;
try
{
var file = files.ElementAt(i);
filename = file.FullName;
}
catch (UnauthorizedAccessException)
{
}
catch (InvalidOperationException)
{
// ran out of entries
}
return filename;
})
.Where(i => null != i);
if (!recurse)
return filesList;
var dirs = top_directory.EnumerateDirectories("*");
var dirsLength = dirs.Count();
var dirsList = Enumerable
.Range(0, dirsLength)
.SelectMany(i =>
{
string dirname = null;
try
{
var dir = dirs.ElementAt(i);
dirname = dir.FullName;
return FindAccessableFiles(dirname, file_pattern,
recurse);
}
catch (UnauthorizedAccessException)
{
}
catch (InvalidOperationException)
{
// ran out of entries
}
return emptyList;
});
return Enumerable.Concat(filesList, dirsList);
}
I've been hitting some performance problems iterating over folder that
have 100k+ files in them - all images that I ignore when I enumerate over
them.
I'm trying to work out how to exclude them from the enumerated list so
they are never processed in the first place but can't work out how to do
it.
I have a List<String> of extension I want to exclude and do this in the
code using Contains.
Would I get a performance gain if I excluded them from FindAccessableFiles
in the first place and how would I do it ? MY initial attempt was the
throw an exception if the file extension was contained in the extensions
list but I'm sure this isn't the best way.
The purpose of FindAccessableFiles is to produce a list of files that
circumvented the problems of GetFiles() throwing an exception trying to
access a file that threw a permissions error.

SQL: Use of with-clause in "not in"-operator

SQL: Use of with-clause in "not in"-operator

is it possible to realize something like this?
WITH subQ(attr1) as (SELECT attr1 FROM tab1)
SELECT tab2.attr2, FROM tab2
where tab2.attr2 not in subQ
I don't want to write the subselect after the "not in".

WiFi - slow download, fast upload. Affects only one device

WiFi - slow download, fast upload. Affects only one device

My desktop computer is getting terrible download speeds, while other
devices work just fine on the same network. Here are speedtest.net results
from my devices, Mbps:
Nexus 4: 24.9 down / 26.8 up
MacBook: 31.3 down / 28.5 up
Desktop: 6.6 down / 28.2 up
All three devices connect to the same network (also tested in the same
physical location), hitting the same remote server. Results stay fairly
consistent between runs.
The desktop PC uses a TP Link TL-WN881ND PCI-e wifi card and runs Windows
8 (identifies as 'Qualcomm Atheros AR9287 Wireless Network Adapter'),
default drivers, no additional wifi-related software installed.
My router is a TP Link TL-WR841N, default firmware. I have tried disabling
WMM, changing router mode / channel width - none of those improved
download speeds on the desktop.
Also, tried using my phone as a wifi hotspot and got the following results:
MacBook: 10.0 down / 1.6 up
Desktop: 9.0 down / 1.6 up
Much closer this time - problems with the specific wifi card / router
combination?

Tuesday, 20 August 2013

Get value of string.xml in android

Get value of string.xml in android

my question is simple. How can i get access to the string value in
res/values/string.xlm in a extends SQLiteOpenHelper because getString
method is use with an Activity ?

Next Page Button [on hold]

Next Page Button [on hold]

So I want to make a simple shoutbox using MySQL and PHP and I know enough
of both languages to produce it rather easily. Also I know how to limit it
to only show the last 5-10 or whatever comments at a time. However, what
would be the process of making it so the shoutbox only shows the last 5
comments and then there is a button that says "Older Comments" and it
shows the next 5 and so on and then another button that says "Newer
Comments" and it goes back a page. I'm not quite sure how I would go about
doing that without writing tons and tons of code.
Here is the code I have for my shoutbox:
addmessage.php
<?php
include("config.php");
if ($_POST['shoutname'] and $_POST['shout'] !== " ") {
if (isset($_POST['shoutname'])) {
$shoutname = mysql_real_escape_string($_POST['shoutname']);
$shout = mysql_real_escape_string($_POST['shout']);
mysql_query("INSERT INTO shoutbox (name, shout) VALUES
('$shoutname','$shout')");
mysql_close($bd);
}
}
header("Location: shoutbox.php");
?>
(config.php contains my mysql connection information)
shoutbox.php
<?php
include("config.php");
$data = mysql_query("SELECT * FROM shoutbox ORDER BY id DESC LIMIT 5");
while ($info = mysql_fetch_array($data)) {
echo $info['name']. "<br>";
echo $info['shout']. "<br>";
}
?>
<form method="post" action="addmessage.php">
Name: <input type="text" name="shoutname" /><br />
Message: <input type="text" name="shout" />
<input type="submit" />
</form>
I'm just not sure how to make a button that shows the next five comments
ordered by id and so on.

On Android, how many apps can be cached in memory at most?

On Android, how many apps can be cached in memory at most?

This may depends on what apps would be cached and what is the total
available memory, as different apps consume different amounts of memory.
Let's assume the total available memory is always sufficient, then how
many apps can be cached in the memory at most? Is this number fixed across
different Android versions? Does it depends on the devices' parameters?

Google Maps not showing in explorer 8 or lower

Google Maps not showing in explorer 8 or lower

i'm currently working on a project, but now i'm stuck on the following.
I created a map that works with a database and pulls the lat, lng data out
of the db and show's it on the map.
That's all working fine.
I just realized that the map is not working on IE8 or lower. I already
tried to include a file that forces the code to work but still no map. So
does anyone know what i could do about it?
thanks in advance.

Combine Rails with AngularJS instead of jQuery

Combine Rails with AngularJS instead of jQuery

In how far does it make sense to combine Rails and AngularJS? I am
currently building a web application which uses Rails on the backend and a
bit jQuery on the front end for small enhancements.
Now I wonder, whether it makes sense to use AngularJS for the front end
implementations.
Example: Filter Search
I can simply implement Filter Search with jQuery, but it seems it will be
a lot faster when using AngularJS. I am not so much into the MVC
structure, but rather implementing responsive features for my web
interface.
Will it make sense to use AngularJS in this case or should I simply look
out for reasonable implementations when doing pure DOM manipulation?

Monday, 19 August 2013

Geolocation give wrong position?

Geolocation give wrong position?

Well I have a problem with Geolocation, when the page is initialized I
have "right" location, after I refresh the page there are different
location, maybe 10 meters from first. After one more refresh I have a
third location, etc.. I tested on this link
https://developers.google.com/maps/documentation/javascript/examples/map-geolocation
, and again I don't have a right position.

Spring Config file

Spring Config file

I am using Spring 3.1.0 version. But I am getting error while deployment
due to dispatcher-servlet.xml. Here is the code I am using:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<context:component-scan base-package="com.mycompany.cart" />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/pages/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans>
Error is :
Error occurred during deployment: Exception while loading the app :
java.lang.IllegalStateException: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line 5 in XML document from ServletContext resource
[/WEB-INF/mvc-dispatcher-servlet.xml] is invalid; nested exception is
org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 93;
cvc-elt.1: Cannot find the declaration of element 'beans'.. Please see
server.log for more details.
I tried to find the correct bean file but not succeeded. Can you guys
please advise where should i search the config file as per my spring
version.

How to Flash CS5 AS3 Random Elastic?

How to Flash CS5 AS3 Random Elastic?

I made a photo gallery, every photo start come in with:
new Tween(uiLoader,"rotationX",Elastic.easeOut,90,0,4,true);
And it's cool but if all photos come in same way, it's little bit tiered
to look at it. So I want to ask is here any code to make it random with
fade, blinds, iris, fly, Dissolve, Squeeze, Wipe, Zoom, rotationX,
Elastic.easeOut???? Here is my code:
function completeHandler(event:Event):void
{
uiLoader.x = (back.width - uiLoader.content.width) >> 1;
uiLoader.y = (back.height - uiLoader.content.height) >> 1;
new Tween(uiLoader,"rotationX",Elastic.easeOut,90,0,4,true);
}

what is wrong with my jquery ajax form post?

what is wrong with my jquery ajax form post?

$("button[name='advocate-create-button']").on("click", function () {
$.ajax({
url: '/Vendor/AdvocateCreate',
type: 'post',
dataType: 'json',
data: $('form#advocate-create-form').serialize(),
success: function() {
$(".modal_overlay").css("opacity", "0");
$(".modal_container").css("display", "none");
}
}).done(function (data) {
var $target = $("#advocate-list-view");
var $newHtml = $(data);
$target.replaceWith(data);
$newHtml.effect("highlight");
});
return false;
});
Almost got this, just need a slight assist to get it done...I'm trying to
post form data to '/Vendor/AdvocateCreate' and once it saves, I want the
dialogue to go away and the list behind it to be updated.
The list behind it is the AdvocateList view and pulls its data from
AdvocateList method in the same controller
AdvocateCreate method
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult AdvocateCreate(Advocate advocate, int page = 1)
{
if (!ModelState.IsValid) return View(advocate);
db.Advocates.Add(advocate);
db.SaveChanges();
var userId = WebSecurity.GetUserId(User.Identity.Name);
var model = (from a in db.Advocates.ToList()
where a.VendorId == userId
select a).ToPagedList(page, 15);
if (Request.IsAjaxRequest()) return
PartialView("_AdvocateListPartial", model);
return View(model);
}
the form tag is thus: <form class="form" id="advocate-create-form">
The create method does get called, the data does get saved, but the lines
under success: do not fire and the data in #advocate-list-view is not
updated
thanks

vb.net create blank xlsx file if it doesn't exist

vb.net create blank xlsx file if it doesn't exist

I need to create a blank .xlsx file if it doesn't exist. Here's my code:
StatVar.SchoolName = FrmMain.ComboBoxSchool.Text & ".xlsx"
StatVar.ExportDirectory = "X:\App Exports\Accounting\Purge\" & "Purge "
StatVar.SchoolPath = StatVar.ExportDirectory & StatVar.SchoolName
'create file if it doesn't exist
If Not File.Exists(StatVar.SchoolPath) Then
File.Create(StatVar.SchoolPath)
End If
This creates the workbook, however, upon opening the, I'm prompted with an
error message: "Cannot open becuase the file format or file extension is
not valid"
Is there any way to create a .xlsx file without using 3rd party projects?

Return to 301 doesn't work on nginx

Return to 301 doesn't work on nginx

This is a well discussed issue of www.domain.com vs domain.com on nginx.
For some reason it doesn't work. Here is my nginx conf file:
server{
server_name www.xyz.com;
return 301 $scheme://xyz.com$request_uri;
}
server {
server_name xyz.com;
access_log /home/access_logs/shiv/access.log;
error_log /home/access_logs/shiv/error.log;
root /home/xyz;
location / {
try_files $uri $uri/ /index.php;
index index.html;
}
location ~ \.php$ {
include /opt/nginx/conf/fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/xyz$fastcgi_script_name;
}
}
Please point out as to whats wrong with this config !!
QUESTION
xyz.com opens just fine.
www.xyz.com just doesn't open
MY DNS ZONE FILE
$TTL 1800
@ IN SOA ns1.abc.com. hostmaster.xyz. (
1376913474 ; last update: 2013-08-19 11:57:54 UTC
3600 ; refresh
900 ; retry
1209600 ; expire
1800 ; ttl
)
IN NS ns1.cpp.com.
NS ns2.cpp.com.
NS ns3.cpp.com.
MX 0 9d209d3837fd2a499a12e566975cce.pamx1.hotmail.com.
@ IN A 192.xxx.xxx.154
www IN A 192.xxx.xxx.154

Sunday, 18 August 2013

Can I manage several "identical" MS SQL Databases with different data?

Can I manage several "identical" MS SQL Databases with different data?

Can I manage several "identical" MS SQL Databases with different data?
I have a set of different stores that belong to different owners I have a
common web application for all of them. The Data bases are identical (same
tables, columns store procedures etc.) but the data obviously is different
depending on the store.
I couldn't have a single database for all of them and have a column in
each table indicating to which store belongs, because of different reasons
like "legal reasons", privacy that each store wants, optimize the product
search, client search, individual backups, etc.
However every time I have to make a change in the application like adding
a new column, change a store procedure I have to repeat the same steps for
each Data Base is there any way I can have only one "MetaBase" in which I
can make the changes and then they will be applied to each individual
database?

Batch file to handle random % character in FOR LOOP

Batch file to handle random % character in FOR LOOP

I am trying to pass file names as FOR loop parameters to a separate batch
file. The problem is, if a file name contains special characters
(especially %), the parameter doesnt go to the called script. EG -
The FIRST_SCRIPT.bat is as follows -
cd "C:\theFolder"
for /R %%a in (*.*) do call SECOND_SCRIPT "%%~a"
The SECOND_SCRIPT.bat is as follows -
ECHO %1
If a file name contains % eg. "% of STATS.txt", the output ends up being
of STATS.txt
Which is wrong. I have tried using Setlocal DisableDelayedExpansion but
with little success
Setlocal DisableDelayedExpansion
for /R %%a in (*.*) do (
SET "var=%%~a"
Setlocal EnableDelayedExpansion
call TEST_UPGRADE "%var%" "%%~a"
)
There are other stackoverflow answers, but they all need the % character
to be known before hand. Since the file names are not in our control,
these solutions won't work for us. Is there any way of handling this?
Thanks!
platform: cmd.exe for Windows XP

How to set a custom directory for layouts in Sinatra?

How to set a custom directory for layouts in Sinatra?

I have a Sinatra app with multiple layouts. I want to isolate them into
their own subdirectory in views:
app.rb
views/
views/layouts/
views/layouts/default.haml
views/layouts/print.haml
views/layouts/mobile.haml
This works, except that I have to explicitly set a layout with each render
call:
get '/' do
haml :index, {:layout => :'layouts/default'}
end
Is there a way to set the layout globally (for all routes within a module,
for example), or to tell Sinatra where look for layouts outside of default
directory?